Back to home
0 / 4 steps
Lesson 1 ยท Beginner

Your first lines of code

No setup. No installs. Read a tiny bit of code, press Run, and watch it work. We'll go one small step at a time.

1

Say hello to the computer

Every coder's first program prints a message. The word console.log tells the computer: "show this to me."

The thing inside the parentheses, wrapped in quotes, is called a string - that just means a piece of text.

Press Run. The output appears on the right.
code.js1 line
Output
Press Run to see what happens.
2

Store something in a variable

A variable is a named box you put a value into. You make one with the word let, give it a name, then use = to put something inside.

Here we make a box called name, put your name inside, then print a greeting that uses it.

Try changing "Alex" to your own name and run again.
code.js2 lines
Output
Press Run to see what happens.
3

Do some math

Computers are excellent at math. Numbers don't need quotes. You can add with +, subtract with -, multiply with *, and divide with /.

Variables can hold numbers too - not just text.

Change the numbers and see the total update.
code.js4 lines
Output
Press Run to see what happens.
4

Put it all together

You've already learned the three biggest beginner ideas: printing, variables, and math. Here they all work together to make a tiny program that figures out how old you'll be on your next birthday.

Read each line out loud - you'll be surprised how much you already understand.

Change myName and myAge to make it about you.
code.js5 lines
Output
Press Run to see what happens.

Run each example to unlock the next step. You can edit the code before running - that's the whole point.