When playing with some JS in Chrome, I noticed that the native
implementation of Object.create throws a TypeError exception (Object
prototype may only be an Object or null) if a function object is passed in,
like:
Object.create(function () {})
The error is both factually incorrect and inconsistent with Crockford's
original implementation, which works fine, if you pass in a function (even
in Chrome):
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
Oddly enough, I'm only seeing this on the Linux and OSX versions of Chrome,
not on Windows. Any ideas why this could be?
- Andrey
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users