Syntax
Programs follow a set of rules that define keywords, symbols, and structure. This is called the syntax. We have already learned about many of the syntax rules in JavaScript for expressing data, variables, and expressions. You will be required to name objects, properties, methods, variables, and functions.
The following is a basic set of rules and conventions. Conventions are another term for best practices. Although not following a convention will not cause issues in your coding, they can make your code less easy to follow and not palatable to other programmers, for example, who may be interviewing you for a job and ask to see your code samples.
The naming rules and conventions for functions and variables are as follows:
- 26 upper and lowercase letters (A-Z, a-z).
- Any character but the first character can be one of 10 digits (0-9).
- No spaces, dashes, or commas. The underscore (_) character is acceptable.
- Capitalization follows camelCase. This means...