Your First Commands

The full text of this chapter, to read or revisit. To practise, do the exercises.

▶ Do the exercises

Exercise 1 — Displaying Output with console.log()

The first command every programmer learns in a new language is how to display "Hello World" with the language he's learning, this course is no exception. In JS, we use console.log().

console.log("Hello World!");

This displays Hello World! in the console.

Like Python's print()

If you've learned Python, console.log() is JavaScript's equivalent of print().

Exercise 2 — Choose Your Codémon!

Here are the 3 starter Codémon:

- Pyrochu 🔥 - Florachu 🌿 - Aquachu 💧

Pick the one you like and replace the `???` in the code below with its name! (Then press run to see the magic happen!)

console.log("I choose ??? !");

Exercise 3 — Complete the console.log()

Complete this code to display a message:

Hint : The syntax is: console.log("message");

Exercise 4 — What Will This Display?

console.log("Florachu"); console.log("Rockachu");

What will this code display?

Options
• Florachu then Rockachu (on separate lines)
• Florachu Rockachu (on the same line)
• Only Florachu
• Only Rockachu

Hint : Each console.log() creates a new line of output.

Back to the course