Most of the variable and function names that we'll be using are entirely made up. We tried to choose names that are descriptive of what the variable is or what the function is doing. So if we have a button and we want a function that will hide something on our page, we could name it hideButton.
There are a few rules to follow when naming variable:
- Use 'camelCase' to name your variables.* This means that the first letter is always lowercase, and the first letter of each following word (in compound word variables) is capitalized. This keeps your variable names predictable and helps you avoid mistakes when reusing variables.
- Here are some good examples: 'getElementById', 'listOfAnwers', 'lolCatButton', 'dayOfTheWeek'
- Here are some bad examples: 'MYvariable', 'Username', 'day_of_the_week'
- Never begin variables with a number
*Note: There are some special cases in which camelCase is not the preferred naming convention, for example, in constructors or some constants. In the vast majority of cases, however, you will want to use camelCase.