There are occasions when I am unable to successfully execute this script!
var b = [9,8,7,6,5,4,3,2,1];
var a = (function(){
var W = [];
for(var k in b){
W[W.length] = {
index : k,
fx : function(){
console.log(k);
}
}
}
return W;
})();
console.log(a);
for(var j = 0; a[j]; j++)a[j].fx();
Why is it not displaying the numerical sequence 987654321 as intended?