In this video, you saw the program you’ll build in this course and what you’ll be able to do by the end of it.
Key Points
- You’ll write a tiny movie-night snack calculator: two lines of JavaScript in a file on your own computer.
- You run it in the terminal, and it prints your movie-night message and what two bags of popcorn at 3 each cost.
- When the plan changes, you change a number, save, and run it again to see the new cost.
- By the end of this course, you’ll create, save, run, and change short programs like this one, and check their output.
- When a typo breaks a line, you’ll read the error. Then you’ll fix it and run again.
- You don’t need any programming experience. If you can install an app and find a file, you’re ready. The first lessons set up VS Code and Node.js, which runs JavaScript on your computer.
- Along the way, you’ll try single lines in Node, save programs in files, and practice in exercises on this site, with automated feedback. At the end, you’ll build the snack calculator and make it your own.
The Program You’ll Build
Here’s the calculator from the video, saved as scratch/snacks.js:
snacks.js
console.log("Movie night starts at eight!");
console.log("Popcorn costs", 2 * 3);
When you run it, the terminal shows this:
Movie night starts at eight!
Popcorn costs 6
With a third friend coming, the 2 becomes a 3:
snacks.js
console.log("Movie night starts at eight!");
console.log("Popcorn costs", 3 * 3);
After you save and run it again, the terminal shows the new cost:
Movie night starts at eight!
Popcorn costs 9
This course comes with sample code and a cheat sheet. The sample code has the files you’ll create in the lessons, plus a starter and a solution for each exercise. Keep the JavaScript cheat sheet open as a quick reference while you work:
First up is the lesson What a Program Does, where you’ll give exact instructions to a helper who follows them to the letter.