8.7 Identifiers
An identifier is the technical term for a program component’s name—the name of a function, the name of a variable, and the names of other program components we’ll get to later on. In the Hello web page, displayHello was the identifier for the function name, and msg was the identifier for a variable. In naming your variables and functions, the JavaScript engine requires that you follow certain rules. Identifiers must consist entirely of letters, digits, dollar signs ($), and/or underscore (_) characters. The first character must not be a digit. If you do not follow these rules, your JavaScript code won’t work.
Coding-convention rules are narrower than the preceding rules. Coding conventions suggest that you use letters and digits ...
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