HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavascriptTip

JavaScript naming conventions

Submitted by: @import:30-seconds-of-code··
0
Viewed 0 times
conventionsjavascriptnaming

Problem


  • Names are case-sensitive, lowercase and uppercase are different.
  • Start variable names with a letter, use camelCase for names.
  • Variable names should be self-descriptive, describing the stored value.
  • Boolean variables are usually prefixed with is or has.
  • Names are case-sensitive, lowercase and uppercase are different.

Solution


  • Variable names should be self-descriptive, describing the stored value.
  • Boolean variables are usually prefixed with is or has.
  • Names are case-sensitive, lowercase and uppercase are different.
  • Start function names with a letter, use camelCase for names.
  • Use descriptive names, usually verbs in the imperative form.
  • Common prefixes are get, make, apply etc.

Context

From 30-seconds-of-code: naming-conventions

Revisions (0)

No revisions yet.