Quantcast
Viewing all articles
Browse latest Browse all 25

CamelCase for variables and method names is the JavaScript convention in common use.

CamelCase for variables and method names is the JavaScript convention in common use.

Python and other languages use snake and other cases. It is nice for a community to converge on one convention so that the style of libraries match the style of our code.

//see this bad example
const cool_lib = require('cool-lib');
const my_nice_stuff = cool_lib.getNiceStuff()

Also in JavaScript I would highly recommend not naming functions and variables differently. Because of the functional features of JavaScript vars and functions are often interchangeable.

const myFunction = function() {
return 'myFunction'
};
vs
function myFunction() {
return 'myFunction'
};
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>