Guide: Initializing Variables with the Equal Operator

In most cases you will see a variable being declared and given an initial value all at the same time. This allows you to use it right away with a proper value.

var myVar = 0;

Creates a new variable called myVar and assigns it an initial value of 0.