Skip to content
🛠️ Learn. Build. Ship. Save. Master NPM Publishing at a Discount

Naming Convention Explained – Camel vs Pascal vs Kebab vs Snake Case

A naming convention is a pattern generally accepted as a suitable format for naming coding entities like variables, functions, and properties.

Most computing languages do not allow using spaces to separate words when naming your code.

For instance, the snippet below will throw an error because it uses space to separate the variable’s name.

let number of oranges = 235;

Try Editing It

The four popular naming conventions developers use instead of the space-separated entity naming style are:

  • camelCase
  • PascalCase
  • kebab-case
  • snake_case

Let’s discuss the four.

Camel case (also called medial capitals) has the following naming convention:

  • Use lowercase for the first letter.
  • Capitalize the initial letter of each word.

Some examples are:

  • iPhone
  • eBay
  • freeCodeCamp

Pascal case (also called upper camel case) has the following naming style:

  • Use uppercase for the first letter.
  • Capitalize the initial letter of each word.

Some examples are:

  • CodeSweetly
  • JavaScript
  • GitHub

Kebab case uses a dash (hyphen) character between words.

Some examples are:

  • margin-top
  • border-radius
  • grid-template-columns

Snake case uses underscores (_) between words.

Some examples are:

  • favorite_countries
  • color_of_the_snow