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.
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.