O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Data in JavaScript

Using data is basic to nearly any JavaScript program, and JavaScript supports quite a number of different data types: numbers, Boolean values, text strings, and so on. You store data values in variables in JavaScript.

As with other programming languages, variables are simply named locations in memory that you use to store data. You create variables in JavaScript with the var statement, and when a variable has been created, it's ready for you to store and retrieve data in.

Here's an example. In this case, I'm creating a new variable named temperature and storing a value of 72 in it using the = assignment operator. When I use this variable in code, JavaScript replaces it with the value 72, so I can display the temperature ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required