Update a record

Take your time, follow the code and check your understanding.

Move blocks into orderObjects
  1. console.log(message);
  2. const message = next.name + ": " + next.points;
  3. const next = {...user, points: user.points + 1};
  4. const user = {name: "Asha", points: 1};
Your answer3 min · no timer

Drag blocks, or use the arrow buttons. Keep the displayed indentation. This task uses the taught sequence; other equivalent programs may also be valid.

Show solution and explanation

Create the original, copy with the changed field, then build the message from the copy.

const user = {name: "Asha", points: 1};
const next = {...user, points: user.points + 1};
const message = next.name + ": " + next.points;
console.log(message);