I would add:

To set the prototype of an object, you modify the 'prototype' property
of its constructor function. To get access to the prototype you can
use myFunction.prototype or myInstance.__proto__.

//Constructor function
var myFunction = function() { /*...*/ }
myFunction.prototype.myProperty = 'myValue';

//Instance
var myInstance = new myFunction();
myInstance.myProperty === 'myValue'; //true

//Access to prototype
myFunction.prototype === myInstance.__proto__ ===
myInstance.constructor.prototype; //true


Happy new year for everyone!
--
S.Cinos
JavaScript Developer at Tuenti.com



2010/12/29 Lasse Reichstein <[email protected]>:
> On Wed, 29 Dec 2010 08:25:33 +0100, Emeka <[email protected]> wrote:
>
>> Is Prototype JavaScript's way of solving Expression Problem? And what is
>> really the difference between __proto__ and Prototype?
>
> That depends on what you mean by "Prototype".
> The internal [[Prototype]] link of objects is a way to inherit (and thereby
> share)
> properties of other objects. It can be used to add new functionality to an
> unknown
> number of existing objects, by assigning the functionality to their shared
> prototype,
> and that way it can be used to solve the Expression Problem. It just
> requires that
> the Expressions all inherit from a shared prototype object.
>
> The non-standard __proto__ property is some Javascript engines' way of
> reflecting the
> internal [[Prototype]] property, making it accessible for both reading and
> writing.
> It's not-standard and not supported by all engines.
>
> /L
>
> --
> 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]
>

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