Re: Object.create() VS functions

2013-10-26 Thread Brandon Benvie
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

Re: Object.create() VS functions

2013-10-26 Thread David Bruant
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

RE: Object.create() VS functions

2013-10-26 Thread Nathan Wall
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

Re: Re: Object.create() VS functions

2013-10-26 Thread Michaël Rouges
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