Javascript
JavaScript Fundamentals -- Logical and Comparison Operators

Comparison Operators -- Equality and Inequality Exercise

PRO
Outline

In the exercise for this section, you need to determine the outcome in each of the following comparisons. Some of the comparisons use strict comparison, and some use abstract comparison. Fork this StackBlitz project to do the exercise.

// 1. 'Hello' == 'hello'

// 2.
const age1 = 30;
const age2 = '30';
// age1 == age2
// age1 === age2

// 3.
const dog1 = { breed: null };
const dog2 = {};
// dog1.breed == dog2.breed
// dog1.breed === dog2.breed

// 4.
const pizza1 = { name: 'pepperoni' };
const pizza2 = { name: 'pepperoni' };
const pizza3 = pizza2;
// pizza1 == pizza2
// pizza1 === pizza3
// pizza2 === pizza3

// 5.
const areYou = true;
const bored = 'true';
// areYou === bored
 

I finished! On to the next chapter