I'm trying to do a simple JS loop where I initialize a variable with a value outside the loop, but for some reason its not working.
Basically, I'd like to have total_money
equals to 20
in my example, but it keeps returning money
var total = 0;
var money = 20;
var ticker = ['money'];
for (tick in ticker) {
total_money = ticker[tick];
}
console.log(total_money);