DEV Community

Cover image for Enough JavaScript to get you Started : #5 Naming Conventions
Adarsh Pandya
Adarsh Pandya

Posted on

Enough JavaScript to get you Started : #5 Naming Conventions

What are conventions?

๐Ÿ‘‰ Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices, and methods for each aspect of a program written in that language.These are guidelines for software structural quality.

PascalCase

PascalCase is a naming convention in which the first letter of each word in a compound word is capitalized. Software developers often use PascalCase when writing source code to name functions, classes, and other objects.


๐Ÿ‘‰ Example :

var UserName = "Adarsh";
Enter fullscreen mode Exit fullscreen mode

camelCase ๐Ÿช

camelCase describes the practice of writing phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, without intervening spaces or punctuation.


๐Ÿ‘‰ Example :

var userName = "Adarsh";
Enter fullscreen mode Exit fullscreen mode

snake_case ๐Ÿ

Snake case is the practice of writing compound words in which the words are separated by one underscore character and no spaces. The first letter is either upper- or lowercase. It is commonly used in declaring variable names, function names, and sometimes computerโ€™s filenames.


๐Ÿ‘‰ Example :

var user_name = "Adarsh";
Enter fullscreen mode Exit fullscreen mode

kebab-case ๐Ÿข

all letters are written in lower case and the words are separated by a hyphen or minus sign. The kebab notation is often used as a convention for naming filenames.


๐Ÿ‘‰ Example :

var user-name = "Adarsh";
Enter fullscreen mode Exit fullscreen mode

Let me know in comment section if you have any doubt or feedback. it's always worth to give time to thriving developer community :)

Keep Coding โค

Hey , Let' Connect ๐Ÿ‘‹

Twitter /
Github

Top comments (2)

Collapse
 
hi_artem profile image
Artem • Edited

Good high level overview!
For more detailed JS naming conventions, I highly recommend to refer to the Airbnb JavaScript Style Guide

Collapse
 
whoadarshpandya profile image
Adarsh Pandya

Airbnb is what i personally prefer โ™ฅ๏ธ but beginners find it overwhelming when they see es6 , react or even something like arrow function, I'll definitely recommend my readers to go through Airbnb Guide at the end of series๐Ÿค“