Key difference with Python - JavaScript allows for camelCase for function arguments and local variables, while Python enforces snake_case for all variable and function names.
- Function and Variable Naming: Popular convention is camelCase for function arguments and local variables (
myFunction
,interestingVariable
). - Class Naming: Traditionally uses PascalCase (first letter of each word capitalized) for constructors (
MyClass
). However, with the introduction of classes in ES6, some prefer using PascalCase for classes as well (MyClass
). - Constants: Typically written in ALL_CAPS_WITH_UNDERSCORES (
CONSTANT_NAME
). - Modules and Packages: Often use lowercase with underscores (
my_module.js
).