In ES5, The Abstract Equality Comparison Algorithm:
If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y.
To Number Conversions Algorithm:If x is an Object, the firstStep is to get primValue, and then it will return ToNumber(primValue).
To Primitive Conversions Algorithm: Return a default value for the Object. The default value of an object is retrieved by calling the [[DefaultValue]] internal method of the object, passing the optional hint PreferredType.
[[DefaultValue]] uses "valueOf" method, and returns a primitive value.
The question is: Object.ValueOf method gets a Object value not a primitive Value. it confuses me .
let a=[]
let b=a.valueOf()// object a
console.log(b)
let c=a.toString()//undefined
console.log(c)
typeof b //object
typeof c //string