I'm trying to understand the valueOf()
method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf
Is there a situation where a variable of any type could return false
for the following check ?
x.valueOf() === x
const obj = {};
const str = "abc";
const strNum = "123";
const number = 123;
const arrStr = ["a","b","c"];
const arrNum = [1,2,3];
console.log(obj.valueOf() === obj);
console.log(str.valueOf() === str);
console.log(strNum.valueOf() === strNum);
console.log(number.valueOf() === number);
console.log(arrStr.valueOf() === arrStr);
console.log(arrNum.valueOf() === arrNum);