-
Notifications
You must be signed in to change notification settings - Fork 4
Camel Case
itsgreggreg edited this page Sep 21, 2015
·
1 revision
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!