© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. BartlettProgramming for Absolute Beginnershttps://doi.org/10.1007/978-1-4842-8751-4_9

9. Basic JavaScript Syntax

Jonathan Bartlett1  
(1)
Tulsa, OK, USA
 

All languages, whether human or computer, have what is called a syntax. The syntax of a language are the ways in which words and symbols are allowed to go together. For instance, consider the English sentence “I ate the the apple.” That sentence has a syntax error—I put two “the”s in a row. That’s simply not allowed (and nonsensical) in English.

But syntax has a larger role than simply telling you how not to form sentences. It also tells you what a sentence means. For instance, if I say, “I have a yellow ...

Get Programming for Absolute Beginners: Using the JavaScript Programming Language 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.