DEV Community

Discussion on: Can you hack this? #1

Collapse
 
afif profile image
Temani Afif • Edited
const personX={};
personX.name=NaN;
Enter fullscreen mode Exit fullscreen mode

OR simply

const personX={name:NaN};
Enter fullscreen mode Exit fullscreen mode

a. If x or y are any of NaN, +∞𝔽, or -∞𝔽, return false. ref

Collapse
 
akashkava profile image
Akash Kava

It will return false only for NaN, because Number.POSITIVE_INFINITY === Number.POSITIVE_INFINITY returns true, and it is same for negative infinity as well.

Collapse
 
alfredosalzillo profile image
Alfredo Salzillo

Also if using a Getter or a Proxy returning different values each time :)

Thread Thread
 
atulcodex profile image
🚩 Atul Prajapati 🇮🇳

You don't know everything 😛