Get Programming with JavaScript - Listing 3.06
Listing 3.06 - Using a variable as a property value
var book;
var bookName;
bookName = "The Adventures of Tom Sawyer";
book = {
title : bookName
};
Further Adventures
Listing 3.06 - Using a variable as a property value - Task 3
- Change the value of the bookName variable.
var book;
var bookName;
bookName = "The Hobbit"; // change bookName
book = {
title : bookName
};