Chapter 2: Programming Basics

In the last chapter, we were introduced to programming and we even got our hands dirty writing a few programs.

In this chapter, we’re going to look at some of the basics of programming and write some more programs.

We’ll cover the following topics:

  • commenting your code
  • programming grammar
  • data types
  • variables
  • pop-up boxes


The first task on your journey to becoming a programmer is learning how to “comment” your code. Comments in programming are similar to marginal notes in a book: they’re notes that explain the purpose and rationale of the code. This may seem a strange place to start, because comments are ignored by the programming language. They don’t do anything. Despite this, comments are extremely ...

Get Learn to Code With JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.