0

Here's a function which checks whether input is a NaN:

function myIsNaN(value) {
  return value !== value;
}

myIsNaN({}) --> outputs false.

Why false if: {} !== {} --> true ???

myIsNaN([]) --> outputs false.

Why false if: [] !== [] --> true ???

VLAZ
  • 22,934
  • 9
  • 44
  • 60
  • `{} !== {}` compares two ***different*** objects. Two different objects are not the same object. Comparing the same object with itself will give you `true` as it does. Same for arrays. – VLAZ May 20 '22 at 04:48

0 Answers0