Object.prototype.clone
Peter Michaux
petermichaux at gmail.com
Sun Oct 21 19:07:50 PDT 2007
Hi,
Is there a plan for a "clone" function in ES4?
Object.prototype.clone = function() {
function F() {}
F.prototype = o;
return new F();
};
The earliest reference I have found to this function is a post by
Lasse Reichstein Nielsen in 2003 on comp.lang.javascript
http://groups.google.com/group/comp.lang.javascript/msg/5d06e72e55d5bf11
In the past year this function has been evangelized by Douglas Crockford.
http://javascript.crockford.com/prototypal.html
Given the idea has persisted for at least a four year period as
something useful in a prototype-based language, would a clone function
be a good addition to the language itself?
Peter
More information about the Es4-discuss
mailing list