Comparison Operators in JavaScript

Level 284 keystrokes

Uses >, ===, and !== operators to compare values.

JavaScript code

// Declare a variable with the value 10
1let num = 10;
// > checks if the left value is greater than the right (10 > 5 is true)
2console.log(num > 5);
// === checks strict equality (same value AND same type)
3console.log(num === 10);
// !== checks strict inequality (not equal in value OR type)
4console.log(num !== 5);

Output

true
true
true
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this JavaScript code and how often they appear.

  • =× 6
  • ;× 4
  • .× 3
  • (× 3
  • )× 3
  • !× 1
  • >× 1

More JavaScript examples at level 2

← JavaScript typing practice