r/javaScriptStudyGroup • • Nov 11 '17

What are the capitalization rules to name objects in Javascript?

Hi, i wanted to know what the capitalization convention was in the Javascript. For instance, Do we use camel case for functionLikeThis, classLikeThis, variableLikeThis, constantlikethis ?

0 Upvotes

2 comments sorted by

3

u/Volv Nov 12 '17

I use / typically see

const THEANSWER = 42; // Not always uppercase const thought. Sometimes see THE_ANSWER or just not bothering and going with theAnswer

function myFunction() { // camelCase
    var myVariable = 42;
    var myOtherVariable = 19;
}

class MyClass() {         // Class start with caps.

}