A variable holds a number then a string — report the final type.
Acceptance criteria
- 1.#out should show string.
JavaScript Tutorial · JavaScript Introduction
These 10 tasks go with the JavaScript Features 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 has many useful features that make it one of the most popular programming languages for web development.” .
1.Show dynamic typingexercise · easy · 10 min
A variable holds a number then a string — report the final type.
Passes when: #out should show string.
2.Use a function as a valueexercise · easy · 10 min · practice plan
Store a function in a variable, call it, and show the result.
Passes when: #out should show called.
3.Use a template literalexercise · easy · 10 min · practice plan
Build the greeting "Hello Ada" with a template literal.
Passes when: #out should show Hello Ada.
4.Use an objectexercise · easy · 10 min · practice plan
Read the title property from an object and show it.
Passes when: #out should show Frontend.
5.Use an array methodexercise · medium · 10 min · practice plan
Double every number in [1,2,3] and join them with dashes.
Passes when: #out should show 2-4-6.
6.Fix the function that is never calledbug fix · easy · 8 min
The function itself is shown instead of its result.
Passes when: #out should show called.
7.Fix the template literal quotesbug fix · easy · 8 min · practice plan
Normal quotes do not interpolate the variable.
Passes when: #out should show Hello Ada.
8.Fix the wrong property namebug fix · easy · 8 min · practice plan
The object has no such property, so this shows undefined.
Passes when: #out should show Frontend.
9.Fix the map that returns nothingbug fix · easy · 8 min · practice plan
The arrow body uses braces without a return.
Passes when: #out should show 2-4-6.
10.Fix the typeof checkbug fix · easy · 8 min · practice plan
This reports the type of the old value.
Passes when: #out should show string.
Between them these tasks cover Dynamic typing, Functions as values and Template literals.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.