Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

brayant benitez
brayant benitez
7,885 Points

Camelcase

Joy mentioned Camelcase, is it only directed to making the language easier to read or will it cause any impact on the program itself?

Domenic Carobine
Domenic Carobine
9,014 Points

It's just the convention in JavaScript for naming variables, function, etc. You can use underscores like other languages in JavaScript, but sticking with camelcase will make your code more readable by other JavaScript users.

1 Answer

Erik Nuber
Erik Nuber
20,629 Points

It just makes things easier to read and faster to type. Any way you declare legal variables makes no real difference. It is just common practice to use camel case.

var areallylongvariablenameishardertoread,

     aReallyLongVariableNameIsHarderToRead,

     a_really_long_variable_name_is_harder_to_read;

all would work just fine.