Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Lesson 06: Naming conventions

How to name variables, functions, classes, constants, files.

What you'll learn

  • 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...)

Example

See examples/.

Exercise

Rename 5 poorly-named variables in a sample file.