Say that we have a function called nameEqualsToItself
how accept a person
object as input that checks if the name property of the input object equal the same name property of the input object implemented like this:
const nameEqualsToItself = (person) => person.name === person.name
Can you find the input that makes nameEqualsToItself
return false
?
const personX = ???
console.log(nameEqualsToItself(personX)) // print `false`
Top comments (12)
OR simply
It will return
false
only for NaN, becauseNumber.POSITIVE_INFINITY === Number.POSITIVE_INFINITY
returns true, and it is same for negative infinity as well.Also if using a Getter or a Proxy returning different values each time :)
You don't know everything 😛
This is big brain, love it
Using a Proxy.
It print true :) try it
It printed false.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.