Assigning a new value with dot notation updates that property while leaving the object's other properties unchanged.
const player = { name: "Mira", score: 4 };
player.score = 7;
console.log(player.score); // outputs 7Predict 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);