On 10/26/2013 7:44 AM, Michaël Rouges wrote:
Knowing that every function is an object, I am surprised that the
Object.create() method doesn't really allow cloning function.
Object.create creates Objects. You run into the same limitation when
trying to create Arrays with Object.create (doesn't
Le 26/10/2013 15:44, Michaël Rouges a écrit :
Bonjour à tous,
Bonjour,
`Knowing that every function is an object, I am surprised that the
Object.create() method doesn't really allow cloning function.
I don't follow the logic of this sentence.
In any case, the purpose of Object.create is to
Before getting into the exact situation with `Object.create` and functions, the
first thing to understand is that `Object.create(proto)` creates an object with
prototype of `proto`. As others have said, this is different from cloning.
Here's a simple example which should show the differences
Thank you for your answers.
Sorry for my misnomer, I meant to copy a function, not to clone a
function.
In fact, it's been a while I do the technical research around the JavaScript
, and this research has led me to realize that there is no feature to simply
copy a function (or class) , including
4 matches
Mail list logo