Creating mutable greeting messages

Report a typo

In JavaScript, you may encounter a situation where you need to output a greeting message, but the message changes after some other operations. Initially, it says Hello World!, after some operations, it changes to Hello JavaScript! The goal is to reorder the lines of code provided in a way that fulfills the situation. Remember, you also have to output the messages after each assignment.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                console.log(greeting);
              
                greeting = "Hello JavaScript!"; // Reassigning the variable
              
                let greeting = "Hello World!"; // This is a string variable
              
                console.log(greeting);
              

Create a free account to access the full topic