Listing 2.06 - Declaring and assigning in two steps - Tasks 1, 2 and 3
- Declare a score variable.
- Assign it a value.
- Display an extra message on the console, by combining variables and strings, to say something like "Kandra has a score of 100"
var playerName;
var locationName;
var score; // declare a score variable
playerName = "Kandra";
locationName = "The Dungeon of Doom";
score = 100; // assign it a value
console.log(playerName + " is in " + locationName);
// display a message on the console
console.log(playerName + " has a score of " + score);