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. And object is not equal to anything except itself. console.log(Object(null)); // Object console.log(null); // Object -- Poetro -- 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]
