Although you are officially only required to use numbers, letter, underscores, the dollar sign and NOT start a variable name with a number, following only these bare minimums can lead to some ugly and unintuitive names. Basic best practices for naming convention:
- Use camel case for readability and add additional context to names: bestPractices, checkBalance, mapLocation
- Implement noun and verb format to provide additional contextual meaning to names: createElement, appendChild, calculateTotal
Structure and Format
General Benefits of Best Practices
- Your code will be easier for others to understand and maintain; vital in any collaborate programming or where you will be handing off your creations.
- Accessing and understanding code examples, snippets and pre-existing code. This will help you greatly when attempting to learn by example, understand tutorials and integrate techniques into your creations.
- Makes it easier for you to review your own code, identify problems, perform updates and make enhancements, even if you haven’t work on a particular project in some time.
- jQuery Core Style Guidelines