Get Programming with JavaScript - Listing 5.03

Listing 5.03 - Passing information to a function

var showMessage; showMessage = function (message) { console.log("The message is: " + message); }; showMessage("It's full of stars!");

Further Adventures

Listing 5.03 - Passing information to a function - Task 1

var showMessage; showMessage = function (message) { console.log("The message is: " + message); }; showMessage("We choose to go."); // Change the message

Listing 5.03 - Passing information to a function - Task 2

var showMessage; showMessage = function (message) { console.log("The message is: " + message); }; showMessage("We choose to go."); // Call the showMessage function twice showMessage("It's full of stars!"); showMessage("I'm going on an adventure!");

Listing 5.03 - Passing information to a function - Task 3

var showMessage; // Change the showMessage function showMessage = function (message) { console.log('"' + message + '" is the message.'); }; showMessage("We choose to go."); showMessage("It's full of stars!"); showMessage("I'm going on an adventure!");