2018-09-30 23:01:58 +01:00
---
id: 56533eb9ac21ba0edf2244ab
title: Understanding Case Sensitivity in Variables
challengeType: 1
2019-02-14 12:24:02 -05:00
videoUrl: 'https://scrimba.com/c/cd6GDcD'
2019-07-31 11:32:23 -07:00
forumTopicId: 18334
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
In JavaScript all variables and function names are case sensitive. This means that capitalization matters.
2020-11-27 19:02:05 +01:00
`MYVAR` is not the same as `MyVar` nor `myvar` . It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you *do not* use this language feature.
2018-09-30 23:01:58 +01:00
< h4 > Best Practice< / h4 >
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
Write variable names in JavaScript in < dfn > camelCase< / dfn > . In < dfn > camelCase< / dfn > , multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.
2020-11-27 19:02:05 +01:00
**Examples:**
2019-05-17 06:20:30 -07:00
```js
var someVariable;
var anotherVariableName;
var thisVariableNameIsSoLong;
```
2020-11-27 19:02:05 +01:00
# --instructions--
Modify the existing declarations and assignments so their names use < dfn > camelCase< / dfn > .
Do not create any new variables.
# --hints--
`studlyCapVar` should be defined and have a value of `10` .
```js
assert(typeof studlyCapVar !== 'undefined' & & studlyCapVar === 10);
```
`properCamelCase` should be defined and have a value of `"A String"` .
```js
assert(
typeof properCamelCase !== 'undefined' & & properCamelCase === 'A String'
);
```
`titleCaseOver` should be defined and have a value of `9000` .
```js
assert(typeof titleCaseOver !== 'undefined' & & titleCaseOver === 9000);
```
`studlyCapVar` should use camelCase in both declaration and assignment sections.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(code.match(/studlyCapVar/g).length === 2);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
`properCamelCase` should use camelCase in both declaration and assignment sections.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(code.match(/properCamelCase/g).length === 2);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`titleCaseOver` should use camelCase in both declaration and assignment sections.
```js
assert(code.match(/titleCaseOver/g).length === 2);
```
# --seed--
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
2020-03-02 23:18:30 -08:00
// Variable declarations
2018-09-30 23:01:58 +01:00
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
2020-03-02 23:18:30 -08:00
// Variable assignments
2018-09-30 23:01:58 +01:00
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
var studlyCapVar;
var properCamelCase;
var titleCaseOver;
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;
```