Chapter 2
Understanding Variables
IN THIS CHAPTER
Getting your head around variables
Assigning names to variables
Introducing JavaScript data types
Figuring out numbers
Stringing strings together
One man's constant is another man's variable.
—ALAN PERLIS
You may have heard about — or perhaps even know — people who, through mishap or misfortune, have lost the ability to retain short-term memories. If you introduce yourself to one of these folks, they’ll be asking you your name again five minutes later. They live in a perpetual present, experiencing the world anew every minute of every day.
What, I’m sure you’re asking yourself by now, can any of the above possibly have to do with coding? Just that, by default, your JavaScript programs also live a life without short-term memory. The web browser executes your code one statement at a time until there are no more statements left to process. It all happens in the perpetual present. Ah, but notice that I refer to this lack of short-term ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access