/ Published in: JavaScript
Expand |
Embed | Plain Text
var singleton = function () { var privateVariable = 0; function privateFunction(x) { //detail... } return { firstMethod: function (a) { return a; }, secondMethod: function (a, b) { return a+b; }, thirdMethod: function () { return privateVariable; } }; }(); alert(singleton.secondMethod(1,2)); //return 3
You need to login to post a comment.
