I don't understand why this doesn't work:
function returnVerse(x){
return function(x) {console.log(x);};
}
for(var x = 9; x>=0; x--){
return returnVerse(x)();
}
I just get undefined as a result.
I've been inspiring myself from this: JavaScript closure inside loops – simple practical example
I understand that this is a scope issue, so I'm trying to create a closure, what am I not getting here?
Thanks in advance!