Codington
0 of 8 problems solved • 0%

Exercise prompt

Update an Object Property

Assigning a new value with dot notation updates that property while leaving the object's other properties unchanged.

Example

const player = { name: "Mira", score: 4 }; player.score = 7; console.log(player.score); // outputs 7

Predict the output

A delivery adds three pens to an inventory object declared with const. Predict the stock display.

const inventory = { item: "Pen", stock: 4 }; inventory.stock += 3; console.log("Stock:", inventory.stock);
What will this code print?