Answer the question
In order to leave comments, you need to log in
Why is the loop variable declared without var?
In the guides, the loop variable is always declared (except for the before declaration) with var
Here is an example:
for (var i in obj) {
result += obj_name + "." + i + " = " + obj[i] + "<br>";
}
function extend(o, p) {
for(prop in p) {
o[prop] = p[prop];
}
return o;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question