On 03.04.2011 1:38, Poetro wrote:
2011/3/29 alexis<[email protected]>:
var k = null;
Object(k) === k -->  false (in Chrome and FF4).

I don't understand how this behavior is consistent with ES5 spec.
In http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf,
15.2.1 and 15.2.1.1, seems to indicate that Object(null) is the same
as new Object(null). 15.2.2.1 specify that :
- if type(value) is object (and null is of type object in js)
- and if value is a native ES object (null should be), do not create a
new object but simply return value.

Am i missing something ?
Object(k) returns a new object whatever k was it doesn't mind.

If k is an object it just returns it as is without any transformation.

var s = new String("hello");

console.log(Object(s) === s); // true

Dmitry.

  And
object is not equal to anything except itself.

console.log(Object(null)); // Object
console.log(null); // Object

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to