JavaScript Closure gotchas by reference not value
Closure sometimes behave undesirably, especially when you want to get by value and not by reference. Consider function outer() { let arr=[{accumulated:-1},{accumulated:-2},{accumulated:-3}]; let i; for (i=0; i<3; i++) { arr[i]["acc...
Oct 24, 20221 min read76