What Is Coding?
Computers are fast but not smart. Find out what code and programs are, why instructions must be exact, and write your first line of JavaScript.
Welcome back!
Step 1 of 13Learn
The robot sandwich
Imagine telling a robot: "Make me a peanut butter sandwich." The robot just stands there. It does not know what a sandwich is!
So you try: "Put peanut butter on the bread." The robot drops the whole jar on top of the bag of bread. Oops.
Computers are like that robot. They are super fast, but they do exactly what you say, nothing more. Coding means writing instructions so clear and exact that a computer can follow them. Those instructions are called code.
Step 2 of 13Diagram
Computers do exactly what you say
- You
- Exact steps (code)
- Computer
- Does EXACTLY what you said
Step 3 of 13Practice · Choose one
Why did the robot drop the whole jar on the bread bag?
Step 4 of 13Learn
Programs are everywhere
A full set of code that does a job is called a program. Video games, apps, websites and even the timer in a microwave are programs.
Code is written in a programming language. Just like people speak English or Spanish, computers can be talked to in languages like Scratch, Python and JavaScript. Scratch uses colorful blocks you snap together. Python and JavaScript use typed words.
In this course you will try JavaScript, which runs in every web browser.
Step 5 of 13Diagram
Programming languages
- Programming languages
- Scratch snap blocks
- Python typed words
- JavaScript runs in browsers
Step 6 of 13Practice · Select all that apply
Which of these run on programs? Pick all that are right.
Select all that apply.
Step 7 of 13Note
Step 8 of 13Practice · Sort into groups
Is it a programming language or not?
Tap an item, then tap its group (or drag it there).
Step 9 of 13Flashcards
Coding words
Tap a card to flip it.
Step 10 of 13Learn
Your first JavaScript
Here is a tiny JavaScript function. A function is a named set of instructions.
function greet() {
return "Hi!";
}The word return means "give this answer back." The text inside quote marks is called a string. When the computer runs greet(), it gives back "Hi!".
Computers are picky: a missing quote mark or curly bracket stops everything. Your turn next!
Step 11 of 13Practice · Code challenge
Change the function so it returns the text Hello, coder! exactly, with the comma and exclamation mark.
greet()
Step 12 of 13Practice · True or false
A computer will figure out what you meant even if your instructions are a little wrong.
Step 13 of 13Practice · Fill in the blanks
Fill in the blanks
A complete set of code that does a job, like a game, is called a .
Lesson complete!