I want to add 52 to the value of a variable I have.
So in principle:
Var chicken = eggs+52
Eggs being 100, so chicken then becomes 152...
Current method is not working. Any ideas?
Use .parseInt() in Javascript
var chicken = parseInt(eggs, 10) + 52;
Var V as Upper Case is a typo.Var.You have a syntax error. Var should be var because JavaScript is case sensitive.
Also you might need to cast eggs as a number, if it is currently a string:
var chicken = +eggs + 52; // the +eggs casts as a number
Remember to check the developer console (F12) when debugging, because usually there is an error pointing to the problem.