Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Equality

Equality is when we use comparison operators to find out if both left and right compared value are equal, (AKA the same).

Course Documentation

Comparison, (and logical), Operators

In the code that we used

var a = '26';
var b = 26;

console.log(a==b); // true (only checks value)
console.log(a===b); // false (compares type as well)

Things are straight forward, as we explain the use of equal sign as comparison operator to find out if:

a==b the values in both a and b, (variables) are the same
and
a===b both the values and the type of a and b variables are the same.

In order to have a better understanding of logical operators here are few more examples of comparison and logical operators.

  • != not equal values between a and b (left and right variable/statement).
  • !== not equal value or not equal type between a and b (left and right variable/statement).
  • > Left statement greater than right statement.
  • < Left statement less than right statement.
  • >= left statement greater than or equal to right statement. and
  • <= Left statement less than or equal to right statement.

For more informations please visit the documentation page of w3schools about comparison and logical operators.

Written with StackEdit.