3 ms·
My style comes from a weird combined history of all the languages I've worked with over the years. I do lowercase snake for_variable_names, camel case forFunct
by claytongulick 4y ago
My style comes from a weird combined history of all the languages I've worked with over the years.
I do lowercase snake for_variable_names, camel case forFunctions() and title case ClassNames.
In markup, CSS class names are kebob-case but IDs follow snake_case rules (this is so that they can be referenced easily and are valid identifiers in js).
I like this approach because I can tell at a glance by the naming convention what kind of identifier I'm dealing with.
I dislike the common js style of everythingIsCamelCase, I find it more difficult to read - and in a language where functions are a primary type, I think it's good practice to differentiate stylistically a variable from a function within the closure or prototype chain.