By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Declare Variables in JavaScript

How to declare variables in JavaScript. Quick Reference showing how to work with variables in JavaScript.

Created: 2011-11-04 06:31

This reference shows how to declare variables in JavaScript. To declare a variable, simply put var in front of the variable name, followed by equals sign and a empty string, or whatever value you want.

var myvariable = 'whatever';

You may also want to check out the Variables JavaScript Tutorial.