CHAPTER 2

image

Data and Decisions

Data and decision making are fundamental to every intelligent program. We’ll begin this chapter by looking at how JavaScript understands, or represents, data. This is important because JavaScript works with a number of data types and manipulates data according to its data type. You can generate unexpected results by mismatching data of different types. We’ll look at some of the more common data type problems, and you’ll see how to convert one type of data to another.

We’ll also be working with conditional statements and loops: two of the most valuable tools for decision making. To make decisions in a computer language, ...

Get Beginning JavaScript with DOM Scripting and Ajax, Second 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.