diff options
author | Nami-Doc <vendethiel@hotmail.fr> | 2013-11-02 17:05:17 -0700 |
---|---|---|
committer | Nami-Doc <vendethiel@hotmail.fr> | 2013-11-02 17:05:17 -0700 |
commit | ed9cd4fb6b93a42b11987fdcff28d4bfafd7977f (patch) | |
tree | 7c3e62ccf9f8ac761e3a12f19d82911a176edbd9 | |
parent | 16d5493b49189860889882aaa027eafe190e67b5 (diff) | |
parent | cba64739f5e61f8fb524dc1cc88cbb31920d2b86 (diff) |
Merge pull request #398 from senatori/master
JavaScript tutorial edit
-rw-r--r-- | javascript.html.markdown | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown index 2ac98105..36aad102 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -306,8 +306,8 @@ myObj.myOtherFunc = myOtherFunc; myObj.myOtherFunc(); // = "HELLO WORLD!" // When you call a function with the new keyword, a new object is created, and -// made available to the function via this. Functions designed to be called -// like this are called constructors. +// made available to the function via the this keyword. Functions designed to be called +// like that are called constructors. var MyConstructor = function(){ this.myNumber = 5; @@ -323,14 +323,14 @@ myNewObj.myNumber; // = 5 // property __proto__. While this is useful for explaining prototypes it's not // part of the standard; we'll get to standard ways of using prototypes later. var myObj = { - myString: "Hello world!", + myString: "Hello world!" }; var myPrototype = { meaningOfLife: 42, myFunc: function(){ return this.myString.toLowerCase() } -}; + myObj.__proto__ = myPrototype; myObj.meaningOfLife; // = 42 |