Skip to content
itsgreggreg edited this page Sep 21, 2015 · 1 revision

What is Camel Case?

Camel Case is simply a convention for naming things like variables and functions in computer programming.

Sometimes we want to use multiple words to name things and since we cannot use spaces when naming things, we instead put all the words together and capitalize the first letter of every word except the first. Like so:

// This is an invalid variable name in Javascript
var number of people;
// Because names can't have spaces.
// So instead we use camel case: numberOfPeople
//  ┌ First word lowercase
//  ⇣     ┌-┌- All other words uppercase
var numberOfPeople;

// more examples:
var daysOfTheWeek;

function twoTimesTwo(){
  return 2 * 2;
}

That's it!