Let's make the world a better place with more concatenation and software that can help us buy rubber ducks! 🦆
Like we learned earlier, when you use the + operator with a string and a number, JavaScript automatically converts the number to a string and concatenates them. In this lesson, we will concatenate more than two strings and numbers together to form larger, more meaningful strings.
Imagine that you are building CodeSteps.dev, and you need to display to the user how many lessons they have completed. Following is code you might write to generate the output message:
let completed = 12;
let total = 250;
let message = completed + " out of " + total + " lessons completed.";
console.log(message); // "12 out of 250 lessons completed."
Now it's your turn! Complete the code sample in the editor to display a well-formatted message listing the total cost of purchasing the rubber ducks in the format: "The total cost of purchasing XX rubber ducks is XX dollars."
Output (Console)