Created
June 2, 2013 06:07
-
-
Save makotom/5692789 to your computer and use it in GitHub Desktop.
Objective JS?
This file contains 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(){ | |
var TestType = function(num){ | |
var target = {}, | |
internal = {num10 : num * 10}; | |
target.firstProp = internal.num10.toString(); | |
target.firstMethod = function(){ console.log("The first method: " + target.firstProp); }; | |
return target; | |
}, | |
Test2Type = function(num, age){ | |
var target = new TestType(num); | |
target.firstProp = num + age; | |
target.secondMethod = function(){ console.log("Just the second method"); }; | |
return target; | |
}; | |
new TestType(10).firstMethod(); | |
new Test2Type(10, 15).firstMethod(); | |
new Test2Type(10, 15).secondMethod(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Somewhat confused...