Javascript Number valueOf() method

Description

Javascript Number valueOf() method


Number.prototype.valueOf = function(){
    return 3/* w w  w .j  ava2  s  .  co  m*/
}

console.log("new Number(2) == 3",new Number(2) == 3)
console.log("Number(2) == 3", Number(2) == 3)


console.log([] == ![])
//2 == "2"
console.log(2 == [2])

console.log(String([null]))
console.log(`"" == [null]: ${"" == [null]}`)

console.log(0 == "\n")
console.log(0 == " ")
console.log(0 == " \n\t\r")

console.log(true == 'true')
console.log(Infinity == Infinity)



PreviousNext

Related