Javascript Method Naming lowercase vs uppercase

Viewed 32113

I am for the most part a developer in ASP.NET and C#. I name my variables starting in lowercase and my methods starting in uppercase. but most javascript examples I study have functions starting in lowercase. Why is this and does it matter?

function someMethod() { alert('foo'); }

vs

function SomeMethod() { alert('bar'); }
5 Answers

A class should always start with a capital letter, because it is easier to read and use:

const data = new Data(); 

Using a capital letter in a function is also easier to read than using lowercase:

User.email 

And strings, int, etc, however, should always start with lowercase to prevent confusion within the code. There is no difference, but it will make it easier to read and understand.

Related