I am doing the following:
function countUp(c){
c.value = c.value + 1;
$('#number').text(c.value);
}
var counter = {value: 0};
window.setTimeout(countUp(counter), 100);
For some reason the value of my counter seems to always stay 1. I tried using an object instead of a variable because it was my understanding that objects are passed by reference, not value, and I hoped I could change this value through my countUp function.
It's clearly not working, what's wrong?
Here is a Codepen