Var++ is NOT Var+=1 (JS)
Nobody ever told me this, so today I just lost a lot of time searching for an hidden bug, to sum it I made an example: var num1 = "1"; var num2 = "1"; num1++; num2+=1; console.log("num1 ++ : "+num1); // console returns 2 console.log("num2 +=1 : "+num2); // console returns 11 The same behaviour applies also whenever you increment properties, in my case a canvas fillRect position which had as coordinates imput values. Summary: If Var in "Var++" is recognised as a string type, the ++ silently converts it into a number type then adds 1, while the "+=1" encountering a var of string type (even if it is a number without any chars) will operate a concatenation. Hope I helped anyone, and sorry if you already knew it. Try it= https://code.sololearn.com/W9W29a2GGrqW/#js