Rehan Sattar
Rehan Sattar

Rehan Sattar



A quick guide to understanding ``

Rehan Sattar
ยทJul 4, 2021ยท

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

The method determines whether two values are the same or not. It returns true if the values are the same and false if not.

let's take a look at the syntax., secondValue);

๐Ÿ‘‰ Here are some of the major points you have to remember while using

  1. doesn't coerce the values as == do.
  2. It performs === on all the compared values except signed zeroes (+0 and -0) and NaNs.
  3. The === operator (and the == operator) treats the number values -0 and +0 as equal, but consider them unequal.
  4. The === operator treats Number.NaN and NaN as not equal but consider them equal.
  5. If objects/arrays are compared then it will compare both values and the reference in memory
  6. This method is not supported by Internet Explorer yet.


// === comparison, 25);                // true'foo', 'foo');          // true'foo', 'bar');          // false, null);            // true, undefined);  // true, window);        // true[], []);                // false

// Object comparison
const foo = { a: 1 };
const bar = { a: 1 };, foo);              // true, bar);              // false

// Case 2: Signed zero, -0);                 // false, -0);                // false, -0);                // true, -0n);               // true

// Case 3: NaN, 0/0);              // true, Number.NaN)        // true

That's it, folks! hope it was a good read for you. Thank you! โœจ

๐Ÿ‘‰ References:

The official documentation of

๐Ÿ‘‰ Follow me: Github Twitter LinkedIn Youtube

Did you find this article valuable?

Support Rehan Sattar by becoming a sponsor. Any amount is appreciated!

See recent sponsors |ย Learn more about Hashnode Sponsors
Share this