This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var F = function() {}; // This is a function object. | |
| var p = F.prototype; // This is the prototype object associated with it. | |
| var c = p.constructor; // This is the function associated with the prototype. | |
| var c === F; // => true: F.prototype.constructor==F for any function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function foo() { | |
| alert("foo"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = function() { | |
| alert("foo"); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = function() { | |
| alert("foo"); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //call before function foo is defined | |
| foo(); //=> alert("foo"); | |
| function foo() { | |
| alert("foo"); | |
| } | |
| //call after function foo is defined | |
| foo(); //=> alert("foo"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //call before function foo is defined | |
| foo(); // will fail, because foo() is not defined. | |
| var foo = function () { | |
| alert("foo"); | |
| } | |
| //call after function foo is defined | |
| foo(); //=> alert("foo"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myObject = { | |
| value: 0, | |
| increment: function() { | |
| this.value +=1; | |
| return this.value; | |
| } | |
| } | |
| myObject.increment(); // => 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myObject = { | |
| value: 0, | |
| increment: function() { | |
| value +=1; | |
| return value; | |
| } | |
| } | |
| myObject.increment(); // => ERROR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myObject = { | |
| value: 0, | |
| increment: function() { | |
| value +=1; | |
| return value; | |
| } | |
| } | |
| myObject.increment(); // => ERROR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get acceleration | |
| PhoneGap.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); |