- OBJECTS
- Basics
- Reference
- Methods
- Constructor
- FUNDAMENTALS
- Hello World
- Code Structure
- Use Strict
- Variables
- Data Types
- Type Conversions
- Maths
-
Comparitions
- Conditional
- Loops
- Functions
- TESTING
- Mocha
- Nested Describe
- TYPES
- Primitives
- Numbers
- Strings
- Arrays
- Json
- DESIGN PATTERN
- Observer Pattern
- CLASSES
- Constructor
- Binding
- Inheritance
Boolean
All comparitions operators return a boolean value.
/**
* A comparition result can be assign to a variable
*/
let a = 2 > 1;
let b = 2 != 1;
console.log(a); // true
console.log(b); // true
Strict
The strict equality operator leaves less room for errors.
/**
* Javascript converts the values to numbers,
* when comparing different types
*
* Strict equality operator is recommended,
* no type conversion
*/
console.assert( '2' > 1 ); // pass Wrong
console.assert( '01' == 1 ); // pass Wrong
console.assert( '01' === 1 ); // failed Correct
Last update: 531 days ago