I'm not sure exactly how to describe what I want. I want to define a function with the parameters being a local VALUE not a reference.
say I have list of objects I want to create
for(i = 0; i < 10; i++){
var div = document.createElement("div");
div.onclick = function(){alert(i);};
document.appendChild(div);
}
Now I believe in this example no matter what div I click on, it would alert "10"; as that is the last value of the variable i;
Is there a way/how do I create a function with the parameters being the value they are at the time I specify the function... if that makes any sense.