Javascript has "function scope" - variables exist only within the function they were created in. yes, supposing your variable is in the global namespace: I believe you need something similar to the following: Had a similar problem. My full-time work is the management of Tribulant Software and the development of its software packages. Here is the code https://stackoverflow.com/questions/837648/how-to-increment-a-javascript-variable-using-a-button-press-event/837652#837652. As the name suggests, ++ the increment operator increments value of operand variable by 1. Arrays can store multiple values in a single variable, which can condense and organize our code. Both are unary operators as they need only one operand. Variable Name. For example, I have a date value 2010-09-11 and I need to store the date of the next day in a JavaScript variable. Example Code alert (value); } JavaScript global variable, Yes, as the others have said, you can use var at global scope (outside of all functions) to declare a global variable: