I created a JavaScript object like this:
var obj = { a: 10, b: 20, add: function(){ return this.a + this.b; } };
I executed the
You didn't execute the function with obj.add, you only looked it up in the object and the environment you're in happened to render the function as a string. You execute it by adding the parentheses.
obj.add