ertaboy356b
Old School Gamer
- Reaction score
- 86
I am recently writing a small javascript game for fun until I hit a roadblock.. At first, I had a hard time figuring out what is wrong with the code. Due to further testing, I concluded that the problem is this:
x = 3;
y = 5;
x + y = 8; // this is correct
x + "." + y = "3.5" // another correct answer
x + "." + y - 1 = "2.5" // WTF!
you can recreate it on Chrome's console. C'mon, try it
Typecasting and parenthesis fixed it though.
x = 3;
y = 5;
x + y = 8; // this is correct
x + "." + y = "3.5" // another correct answer
x + "." + y - 1 = "2.5" // WTF!
you can recreate it on Chrome's console. C'mon, try it
Typecasting and parenthesis fixed it though.