|
|
|
|
|
by lhorie
4998 days ago
|
|
Not sure I understand your comment, given the link you gave. IMHO the return value of calling `Object()` without parameters is exactly what one would expect. Calling it w/ parameters is what I think causes surprising behavior var x = {a: 2}
console.log(x === x) // true
console.log(Object(x) === x) // true
console.log(new Object(x) === x) // true
For the `Object.call(x)` case, I'd expect it to return a new object (and not x), for the same reason I'd expect [].slice.call(arguments) to return a new array (and not arguments). |
|