Skip to content
Chapter 01 of 07 · 3 lessons · ~27 min

Getting Started With JavaScript

Add JavaScript to a page, store information in variables, and understand the types of data JavaScript works with.

YOUR PROGRESS0%
/ Lessons in this chapter
01
What Is JavaScript and How to Add It to HTML What JavaScript does on a website, how to connect it to your HTML, and how to see your first code run. Coming soon
02
JavaScript Variables: let vs const vs var How to store information in variables, and the difference between let, const and var. Coming soon
03
JavaScript Data Types Explained The kinds of data JavaScript works with, how to check them, and the surprises that trip up beginners. Coming soon

Chapter practice task

Task: Add a personal greeting to your portfolio

  1. Create js/main.js and link it with defer at the end of your <head>.
  2. Store your name and your number of years of experience in const variables.
  3. Build a sentence with a template literal and log it to the console.
  4. Show the sentence on the page inside a <p id="greeting">.
  5. Change the greeting depending on the time of day (you’ll finish this in the next chapter).

By the end of this chapter

  • You can add JavaScript to any page and open the console
  • You know when to use const and let, and why to avoid var
  • You understand strings, numbers, booleans, null, undefined, arrays and objects

Quick answers for this chapter

Where does JavaScript run?

In the visitor’s browser. Every modern browser has a JavaScript engine built in.

Do I need to install anything?

No. A browser and a code editor are enough.

What’s the console?

A panel in your browser’s DevTools where you can see messages and errors from your code and try out JavaScript.