Created
November 29, 2014 13:47
-
-
Save michalkowol/4e7791c0fe7d8f981d7a to your computer and use it in GitHub Desktop.
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 com = com || {}; | |
| com.MTVClass1 = function (videoID) { | |
| "use strict"; | |
| var self = {}; | |
| function bar() { | |
| return "bar" + videoID; | |
| } | |
| self.foo = function () { | |
| return "foo" + bar() + videoID; | |
| }; | |
| return self; | |
| }; | |
| com.MTVClass1("123").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 com = com || {}; | |
| (function () { | |
| 'use strict'; | |
| com.MTVClass2 = function (videoID) { | |
| this.videoID = videoID; | |
| }; | |
| function bar() { | |
| return "bar"; // does not have access to videoID | |
| } | |
| com.MTVClass2.prototype.foo = function () { | |
| return "foo" + bar() + this.videoID; | |
| }; | |
| }()); | |
| new com.MTVClass2("1234").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 com = com || {}; | |
| com.MTVClass3 = (function () { | |
| 'use strict'; | |
| function MTVClass3(videoID) { | |
| this.videoID = videoID; | |
| } | |
| function bar() { | |
| return "bar"; // does not have access to videoID | |
| } | |
| MTVClass3.prototype.foo = function () { | |
| return "foo" + bar() + this.videoID; | |
| }; | |
| return MTVClass3; | |
| }()); | |
| new com.MTVClass3("123").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 com = com || {}; | |
| com.MTVClass4 = (function () { | |
| 'use strict'; | |
| function MTVClass4(videoID) { | |
| this.videoID = videoID; | |
| } | |
| function bar(self) { | |
| return "bar" + self.videoID; | |
| } | |
| MTVClass4.prototype.foo = function () { | |
| return "foo" + bar(this) + this.videoID; | |
| }; | |
| return MTVClass4; | |
| }()); | |
| new com.MTVClass4("123").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 com = com || {}; | |
| com.MTVObject = (function () { | |
| "use strict"; | |
| var self = {}; | |
| function bar() { | |
| return "bar"; | |
| } | |
| self.foo = function () { | |
| return "foo" + bar(); | |
| }; | |
| return self; | |
| }()); | |
| com.MTVObject.foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment