diff options
Diffstat (limited to 'javascript.html.markdown')
| -rw-r--r-- | javascript.html.markdown | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/javascript.html.markdown b/javascript.html.markdown index 2ac98105..b6d4c8b7 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -107,10 +107,10 @@ false;  // There's also null and undefined  null; // used to indicate a deliberate non-value -undefined; // used to indicate a value is not currently present (although undefined -           // is actually a value itself) +undefined; // used to indicate a value is not currently present (although +           // undefined is actually a value itself) -// false, null, undefined, NaN, 0 and "" are falsy, and everything else is truthy. +// false, null, undefined, NaN, 0 and "" are falsy; everything else is truthy.  // Note that 0 is falsy and "0" is truthy, even though 0 == "0".  /////////////////////////////////// @@ -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,7 +323,7 @@ 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, @@ -331,6 +331,7 @@ var myPrototype = {          return this.myString.toLowerCase()      }  }; +  myObj.__proto__ = myPrototype;  myObj.meaningOfLife; // = 42 | 
