iegorov
8/14/2013 - 3:00 AM

using that example

using that example

var add = function (a, b) {
  return a + b;
};
var myObj = {value: 0,
	increment: function (inc) {
		this.value += typeof inc === 'number' ? inc : 1;
	}
};
myObj.double = function () {
	var that = this;
	var helper = function () {		
		that.value = add(that.value, that.value);
	};
	helper();
};
$(function () {
	myObj.increment(3);
	myObj.double();
	console.log(myObj.value);
});