What Is camelCase? Usage and Examples
camelCase joins multiple words with no spaces, starting the first word in lowercase and capitalizing only the first letter of each following word.
The rules of camelCase
The name comes from the humps of a camel formed by the rising capital letters. For example, user profile image becomes userProfileImage.
Starting with a lowercase letter is the key point, which is why it is sometimes called lowerCamelCase.
Where it is used
- Variable and function names in JavaScript, Java and C#
- Keys in JSON data (e.g. firstName, createdAt)
- Object property names
- Request and response fields in many APIs
How it differs from PascalCase
PascalCase capitalizes the first letter of every word including the first (UserProfileImage). It is camelCase with the first letter also capitalized.
By convention camelCase is used for variables and functions, while PascalCase is used for class, type and component names.
Converting quickly
When you need to turn snake_case or text with spaces into camelCase, just paste it into the converter above. Multiple lines are handled at once.