Chapter 2: Programming Basics

In the last chapter, we introduced JavaScript, then set up a programming environment. We even got our hands dirty with a few JavaScript programs. In this chapter, we’ll delve further and learn how JavaScript works, as well as write some more programs.

This chapter will cover the following topics:

  • The importance of well-commented code

  • JavaScript grammar ― expressions, statements, semicolons and whitespace

  • Primitive data types

  • Strings ― string literals, string properties and methods

  • Declaring and assigning constants and variables

  • Numbers ― decimal, hexadecimal, octal, binary and exponent form, Infinity, and NaN

  • Arithmetic operations such as +, -, *, /, and %

  • Undefined and null

  • Booleans ― truthy and falsy ...

Get JavaScript: Novice to Ninja, 2nd Edition 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.