Files
Nicholas Carrigan (he/him) 7117919d36 chore(learn): audit javascript algorithms and data structures (#41092)
* chore(learn): audit basic algorithm scripting

* chore(learn): audit basic data structures

* chore(learn): audit basic javascript

* chore(learn): audit debugging

* chore(learn): audit es6

* chore(learn): audit functional programming

* chore(learn): audit intermidate algorithms

* chore(learn): audit js projects

* chore(learn): audit object oriented programming

* chore(learn): audit regex

* fix(learn): remove stray .

* fix(learn): string to code

* fix(learn): missed some

* fix(learn): clarify strings

Based on Randy's feedback, clarifies string instances where quotes
were removed in favour of back ticks.

* fix: apply suggestions - thanks Randy! :)

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* fix: non-suggestion comments

* chore(learn): remove comments from codes

Removes the comments from the description and instruction code
blocks to ensure that all relevant information is translatable.

* fix: Apply suggestions from code review

Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>

* fix: revert crowdin fix

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* fix: Apply suggestions from code review

Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md

Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>

* fix: Apply suggestions from code review

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>

* chore: change voice

* fix: Christopher Nolan

* fix: expressions would evaluate

* fix: will -> would

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* fix: to work to push

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md

Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-03-02 17:12:12 -07:00

101 lines
2.3 KiB
Markdown

---
id: 56533eb9ac21ba0edf2244ab
title: Understanding Case Sensitivity in Variables
challengeType: 1
videoUrl: 'https://scrimba.com/c/cd6GDcD'
forumTopicId: 18334
dashedName: understanding-case-sensitivity-in-variables
---
# --description--
In JavaScript all variables and function names are case sensitive. This means that capitalization matters.
`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.
**Best Practice**
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.
**Examples:**
```js
var someVariable;
var anotherVariableName;
var thisVariableNameIsSoLong;
```
# --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 the string `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.
```js
assert(code.match(/studlyCapVar/g).length === 2);
```
`properCamelCase` should use camelCase in both declaration and assignment sections.
```js
assert(code.match(/properCamelCase/g).length === 2);
```
`titleCaseOver` should use camelCase in both declaration and assignment sections.
```js
assert(code.match(/titleCaseOver/g).length === 2);
```
# --seed--
## --seed-contents--
```js
// Variable declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
// Variable assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
```
# --solutions--
```js
var studlyCapVar;
var properCamelCase;
var titleCaseOver;
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;
```