I was reading the source code of core-js
and I saw the following:
if (value != value) return true;
What does it actually mean? When exactly value
won't be equal to itself?
I was reading the source code of core-js
and I saw the following:
if (value != value) return true;
What does it actually mean? When exactly value
won't be equal to itself?
It could be if:
value
is NaNconsole.log(NaN != NaN);
value
is actually a getter on the global object, and it returns something different each time:let i = 0;
Object.defineProperty(window, 'value', { get: () => i++ });
console.log(value != value);