Is JavaScript case sensitive?

Do I have to distinguish uppercase and lower case when I use a Javascript methods.

Are they different ’ console.log(‘hello’.toUpperCase()); ’ and ’ console.log(‘hello’.touppercase()); ’ ?

JavaScript is case sensitive so all methods and functions must be written the way they appear in the specs.

.toUpperCase()  versus  .touppercase()

.toLowerCase()  versus  .tolowercase()

.toString()     versus  .tostring()

and so on. We cannot vary from the specified names.

It is typical in JS when combining words in a name to use camelCase, with the first letter in lowercase, and the rest of the word starters capitalized.

Another less typical form is called snake_case but we rarely see that in JS. It’s more of a Python thing.

9 Likes

Conversely, this does not apply to JS operators.

typeof

being a perfect example. Look down this rabbit hole, too.

1 Like

Yes, JavaScript is case sensitive. That means toUpperCase() is different from touppercase().
The syntax should be the same as it is otherwise you will face errors like this:Annotation 2020-06-09 173814

1 Like