If your environment has `Object.create` implemented you dont have to
use `new`, but Object.create itself would use new unless implemented
by the JavaScript engine. An implementation of `Object.create` is the
following:

if (!Object.create) {
    Object.create = function (o) {
        if (arguments.length > 1) {
            throw new Error('Object.create implementation only accepts
the first parameter.');
        }
        function F() {}
        F.prototype = o;
        return new F();
    };
}

This is what Dmitry added inline.

2011/7/16 Xavier MONTILLET <[email protected]>:
> An implementation of new using new is kind of weird...

-- 
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]

Reply via email to