Novice here, trying to grasp how this
and arguments
differ and in which circumstances one is used instead of the other?
For example, this prototype function will use this
to perform some manipulation:
myObj.prototype.myFunc = function(){
return this.(some manipulation);
}
Similarly, arguments
is used to loop through each argument to be manipulated:
function myFunc() {
for (var i = 0, i < arguments.length; i++){
return arguments[i].(some manipulation)
}
}
Basically in these two examples, the two seem interchangeable, in terms of being accessed as a parameter for further manipulation? I've been reading through various explanations here at Stack Overflow of each alone (like this), but in practice, I'm still quite confused as to which to use when it comes to application/context. When I do searches on the search engines, the "this" is often misunderstood or ignored, likely because of the frequency of its appearance...
Any help much appreciated!