typescript · 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. They run 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 they appear 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("Fish", "and", "chips");
your turn
Your turn. Write a knock knock joke.
Type who is at the door on lines 3 and 4, the same both times. Put your punchline on line 5, then press run and enjoy your output.
fix it
The cheer will not run. Can you fix it?
- TypeScript says
',' expected. Expected means it was waiting for something that never came. - There should be a comma between each string inside the brackets.
- Add a comma after "Hip" and after "hip", then press run.
nailed it
you made the computer tell a joke. :D
- Lines run in order, from top to bottom.
- An empty
console.log()makes a blank line. - Commas let one
console.logshow several strings, with spaces between.
new words in your collection
- output
This lesson isn’t saved. A free account remembers every lesson you finish.