I know it's a very basic question, but since I am a beginner I have very limited knowledge about it. I tried to understand it by googling various online sources, but could not get a crystal clear view of it. Thanks in advance.
1 Answer
A method, in JavaScript, is a function that is set on an object property; no more, no less.
window.f = function() {} // method of `window` a = { g: function() {} // method of `a` }; function x() { var h = function() {} // not a method, because it's in a local variable, // not in an object attribute var b = { i: h }; // method of `b` now. };
this(orself, in other languages) in the process.