Describing Things in JavaScript

Have you noticed how we introduce new things in JavaScript?

​ ​var​ speed = 10;
​ ​var​ title = ​'3D Game Programming for Kids'​;
​ ​var​ isCool = ​true​;

The var keyword declares new things in JavaScript. It tells both the computer and the humans reading the code, “Get ready—something new is coming!”

The var Keyword

The var keyword is short for variable. A variable is a thing that can change.

images/javascript_basics/variable_changing.png

First, the variable i is set to the value of 0. Then, it is set to 1. Last, the variable is set to the value of two. The value that the variable points to changes—it varies—as the code ...

Get 3D Game Programming for Kids, 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.