Practice Exercises

Fresh problem set — variables → arrays, then a calculator engine. 3 test cases each, no hints.

⬇️ Download all exercises (.zip)
How to use
  1. Open a lesson file. Write your answer where it says // your code here.
  2. Delete the // in front of the console.log(...) line to switch it on.
  3. Run it in the terminal, e.g. node 1-variables.js, and match all 3 test cases.
  1. 11-variables.jsconst / let, reassignment, arithmetic, joining strings
  2. 22-data-types.jstypeof, Number / String / Boolean, the string-plus-number trap
  3. 33-operators.jscomparison, && || !, %, default with ||
  4. 44-if-statements.jsif / else if / else, grading, fizzbuzz of one number
  5. 55-strings.jslength, indexing, slice, includes, case, number↔string
  6. 66-loops.jsfor / while, digits, primes, reverse, palindrome
  7. 77-functions.jsparameters, return, defaults, calling functions from functions
  8. 88-objects.jskeys, values, in, delete, spread merge, top value
  9. 99-arrays.jsindex, push/shift, includes, sum/max/average, build new arrays
  10. 10-calculator-mvp.jsMVP ladder: digits → operators → apply one op → read & compute an expression → full left-to-right engine
  11. 1111-database-countries.js100 real country objects — map/filter/find/reduce/sort, easy → boss (group & density)