Skip to content

JavaScript equality table

  • by

Using a double equal sign you can test the equality of 2 or more operands. There are two operators checking equality in javascript == & === (with respectively != & !==).

JavaScript equality table

Note: Always use strict equals unless you have a good reason to use 2.

Link: https://dorey.github.io/JavaScript-Equality-Table/

JavaScript equality table

Simple example code.

Equality (==)

console.log(1 == 1); // true

console.log('hello' == 'hello'); // true

console.log('1' ==  1); // true

console.log(0 == false); // true

Strict equality (===)

console.log(1 === 1); // true

console.log('hello' === 'hello'); // true

console.log('1' ===  1); // false

console.log(0 === false); // false

JavaScript Equality Table Game: https://eqeq.js.org/

Do comment if you have any doubts or suggestions on this JS equal operator topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading