For example, if the OP asks why the array arr
is not full in the following code:
for (var i=0;i<10;++i) {
var arr=new Array();
arr[i]=i;
}
Is it better to simply say "put the arr
initialisation outside the loop", or to totally rewrite the poster's code to do it for them?
The reason I ask is that it makes sense to me to just suggest an answer and have the poster learn something by figuring it out for themselves.
If you just give them the answer on a plate, they will expect that in future, possibly even asking the same question again because they didn't learn the first time.