Command Palette

Search for a command to run...

Hectal
Phase 6: Objects
JavaScript · Exercise 3 of 5 PreviousNext
Intermediate

Merge settings and strip secrets

Write mergeSettings(defaults, saved): return a new object with every default, overridden by anything in saved. Neither argument may change.

Write withoutSecrets(account): return a new object with everything except password and token. The original account must keep all its keys.

What Check tests

  1. mergeSettings combines both, with saved values winning
  2. mergeSettings returns a new object and changes neither argument
  3. mergeSettings works when nothing was saved
  4. withoutSecrets removes password and token only
  5. withoutSecrets leaves the original account untouched

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.