-
Book Overview & Buying
-
Table Of Contents
Node.js for Beginners
By :
There are many ways to write conditional statements in JavaScript, but the most common are if, switch, and the ternary operator (?:).
For mathematical operations, we have the following operators: >, <, >=, and <=. They are used to compare two values and return a Boolean value. Their use is the same as in most modern programming languages.
Equality operators are used to compare two values and return a Boolean value. There are two types of equality operators: strict (=== and !==) and non-strict (== and !=).
The strict equality operator cannot be used to compare non-primitive types (such as object, array, and function) and certain values such as NaN, as it will always return false:
console.log([1,2] === [1,2]) // false
console.log({ name: 'John' } === { name: 'John' }); // false
console.log(NaN === NaN); // false It is not recommended to use non-strict equality operators...