How to name variables, functions, classes, constants, files.
- variables & functions: camelCase →
userName,getUserById - classes & constructors: PascalCase →
UserService,HttpClient - true constants: UPPER_SNAKE_CASE →
MAX_RETRIES,API_URL - private-ish: leading underscore →
_internalCache - files: kebab-case →
user-service.js - booleans read as yes/no:
isActive,hasPermission,canEdit - identifiers can't start with a digit; can't be reserved words (
class,return...)
See examples/.
Rename 5 poorly-named variables in a sample file.