Syntax Rules

At their core, programming languages are collections of rules that allow us to tell a computer what to do. Actions like Repeat 25 times, Prompt the user for a password, or Display text on the screen can be done with any language. However, each one uses different methods to complete the tasks.

Syntax refers to the structure of a language (spoken, programming, or otherwise) and the rules about that structure. For example, in English, a sentence must begin with a capital letter and end with proper punctuation.

JavaScript and other languages can only run a program if it is syntactically correct, and each language is pretty rigid and unforgiving if you make a mistake. While humans are good at overlooking minor grammar and syntax errors, computers cannot do the same.

For example, the following sentence will send English teachers into fits, It iz a tooth universe ally ack know ledged, tat a seengle man in po session off a good for toon, moose bee n wat off a wive. Despite being poorly written, we can still make some sense out of the words. It might take some re-reading, but eventually we will get the point. Other examples include vanity license plates:

KC ROKSKansas City (or Casey?) Rocks
4EVERL8All parents who ever needed to get the kids to practice

Computers cannot interpret or overlook mistakes like humans. Any syntax errors, no matter how minor, will prevent the code from running. Instead of trying to work around the issue, the program will immediately crash and generate error messages.