Skip to content

Instantly share code, notes, and snippets.

@makotom
Created June 2, 2013 06:07
Show Gist options
  • Save makotom/5692789 to your computer and use it in GitHub Desktop.
Save makotom/5692789 to your computer and use it in GitHub Desktop.
Objective JS?
(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();
})();
@makotom
Copy link
Author

makotom commented Jun 2, 2013

Somewhat confused...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment