Get Programming with JavaScript - Listing 2.02

Listing 2.02 - Assigning a value to a variable

var score; score = 100;

Further Adventures

To assign a value, use the assignment operator, =.

Listing 2.02 - Assigning a value to a variable - Task 4

var score; score = 2500;

Video Tutorials

Declaring a variable and assigning it a value

Accessing the value of a variable at the console prompt