Declare userName and read it with the same casing.
Acceptance criteria
- 1.#out should show matched.
JavaScript Tutorial · JavaScript Statement & Expression
These 10 tasks go with the JavaScript Case Sensitivity chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “JavaScript is a case-sensitive programming language.” .
1.Match variable casingexercise · easy · 10 min
Declare userName and read it with the same casing.
Passes when: #out should show matched.
2.Use correct method casingexercise · easy · 10 min · practice plan
Uppercase a word using the correctly cased method.
Passes when: #out should show CASED.
3.Distinguish two namesexercise · easy · 10 min · practice plan
value and Value are different — show the lowercase one.
Passes when: #out should show lower.
4.Use a built-in with exact casingexercise · easy · 10 min · practice plan
Get the length of "four".
Passes when: #out should show four letters.
5.Keep object keys consistentexercise · medium · 10 min · practice plan
Read a camelCase property from an object.
Passes when: #out should show consistent.
6.Fix the mismatched variable casebug fix · easy · 8 min
The name is declared and read with different casing.
Passes when: #out should show matched.
7.Fix the method casingbug fix · easy · 8 min · practice plan
touppercase is not a real method.
Passes when: #out should show CASED.
8.Fix the property casingbug fix · easy · 8 min · practice plan
The object key is camelCase but read in lowercase.
Passes when: #out should show consistent.
9.Fix the built-in property casebug fix · easy · 8 min · practice plan
Length with a capital L does not exist.
Passes when: #out should show four letters.
10.Fix the wrong variable pickedbug fix · easy · 8 min · practice plan
The uppercase-named variable is read by mistake.
Passes when: #out should show lower.
Between them these tasks cover Case-sensitive names and Built-in method casing.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.