I have a varible
var resources = {
survivors: 1,
wood: 0,
stone: 0,
food: 0,
water: 0,
};
And in another file I want to add 2 to the resources.wood with resources.wood = resources.wood + parseInt(a);
But instead of 2, 4, 6, 8 I get 2222. I also tried with resources.wood += parseInt(a);
resources.wood += parseInt('2')
resources.wood += parseInt(a)
resources.wood += parseInt("2")
and so on but i just get 22222222 as output.
I am running this code to try and add resources.wood.
setInterval(function(){
if(woodChopingWorkers >0){
resources.wood += (woodChopingWorkers*multiplier)/10;
console.log(resources.wood);
}
}, 100)