javascript · level 1 · unit 1 · lesson 3
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
Lines run in order, one after another.
A program can have lots of lines. JavaScript runs them in order, top to bottom, like ticking off a shopping list. Everything your program shows on the screen is called its .
An empty console.log() has nothing to show, so you get a blank line. It is handy for spacing things out.
You can also give one console.log several strings. Put a comma between them and JavaScript shows them on one line, with a space between each.
console.log("Ready");
console.log("Steady");
console.log();
console.log("Go!"); The commas go between the strings, outside the quote marks.
guess first
How will this look on the screen?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
console.log("Salt", "and", "vinegar");
your turn
Your turn. Write the menu for a café.
Fill in a starter, a main and a pudding, each inside its quotes. Line 2 makes a blank line under the title. Press run and admire your output.
fix it
The cheer will not run. Can you fix it?
- JavaScript cannot read this line. Look at what sits between each string inside the brackets.
- There should be a comma between every pair of strings. One comma is missing.
- Add a comma after "hip", then press run.
nailed it
you wrote a whole menu. :D
- Lines run in order, from top to bottom.
- An empty
console.log()makes a blank line. - Commas show several strings on one line, with spaces between.
new words in your collection
- output
This lesson isn’t saved. A free account remembers every lesson you finish.