I'm new to JavaScript. I've read that the context of this changes depending on how the function is being invoked (ie: from a variable, as a callback etc). I cannot find anything that says when I need to use this and when I don't. I've seen lots of code use this and seen code without it.
ie: Here is a for loop inside a function. It works. It doesn't use this
var output="";
for(var i=0; i<input.length; i++) {
output = input.charAt(i) + output;
}
return output;