Hiprup

What are JavaScript naming conventions?

Consistent naming makes code readable and predictable.

  • camelCase — variables and functions (userName, getData).

  • PascalCase — classes and constructors (UserProfile).

  • UPPER_SNAKE_CASE — constants (MAX_SIZE).

  • Booleans — prefix with is/has/can (isActive, hasAccess).

  • Private — a leading # for true private fields (or _ by convention).

Above all: be descriptive and consistent — names should reveal intent.

camelCase (variables/functions), PascalCase (classes/components), UPPER_SNAKE_CASE (constants). Boolean prefixes (is/has/can) show intention. # for private fields (ES2022).

Consistent naming demonstrates professionalism.

What are JavaScript naming conventions? | Hiprup