Chapter 2. JavaScript Basics

Now it’s time to learn the basics of javascript. This chapter and the next two chapters on objects and events combine simple examples with general discussion about how the various aspects of JavaScript work. In later chapters, I will bring these ideas together in practical and useful ways.

When I am asked how programming works, my simple reply is: There is data, and there is code that acts on data. Most of this chapter is divided into two sections around this thought. First, you will see all the ways that data can be stored within JavaScript. Second, you will see all the code structures that allow you to run various kinds of tests and processes on that data. These code structures make up the basic building blocks ...

Get Scriptin’ with JavaScript and Ajax: A Designer’s Guide 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.