I\’am programming in node.js and i run into a small problem what is caused by some strange pass by reference problem.
i use the following code:
for(j in groups){
console.log(j, somefunction(groups[j]))
}
inside of the function some funky things are done with the data but afterwards i get the following as result:
3 data
3 data
3 data
3 data
3 data
3 data
instead of
1 data
2 data
3 data
4 data
5 data
6 data
but it keeps the correct amount of result..





Rating:
The post node.js – Javascript loop reference appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/node-js-javascript-loop-reference.html
No comments:
Post a Comment