var message;
message = "Hello World!";
console.log(message);
message = 'Congratulations! Your tweet has won a prize...';
console.log(message);
Further Adventures
Listing 2.05 - Assigning text to variables - Task 1
Assign message a third value.
Display it on the console.
var message;
message = "Hello World!";
console.log(message);
message = 'Congratulations! Your tweet has won a prize...';
console.log(message);
message = "My message"; // assign message a value
console.log(message); // display it on the console
Listing 2.05 - Assigning text to variables - Task 2
Split the first message into two pieces, joined by +.
var message;
message = "Hello " + "World!"; // join text with +
console.log(message);
message = 'Congratulations! Your tweet has won a prize...';
console.log(message);
message = "My message";
console.log(message);
Listing 2.05 - Assigning text to variables - Task 3
Split the second message into three pieces, joined by +.
var message;
message = "Hello " + "World!";
console.log(message);
// split into three pieces, joined by +
message = 'Congratulations!' + ' Your tweet has' + ' won a prize...';
console.log(message);
message = "My message";
console.log(message);
Video Tutorials
Joining pieces of text (strings) to form a message