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
var chain = (function() { | |
var count = 0; | |
function Inner() { | |
var self = this; | |
self.funcA = function(num) { count += num; return self; } | |
self.funcB = function() { count += 2; return self; } | |
self.ok = function() { var result = count; count=0; return result; } | |
} | |
return new Inner(); | |
}()); |
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
var _ = require('underscore'); | |
function MyClass() { | |
this.prop1 = {}; | |
this.prop2 = {}; | |
this.prop3 = {}; | |
} | |
MyClass.prototype.func1 = function (obj) { | |
var self = this; | |
_.extend(self.prop1, obj); |