Search⌘ K
AI Features

Exercise 4: Discount? Wow

Explore how to apply a 10% discount to an object property in JavaScript by writing a setPrice function and using the set keyword. This lesson helps you practice updating object properties with setter methods and understand practical usage through coding challenges.

Problem Statement

This exercise has two parts.

First Part

The shop has decided to offer a 10% discount on Cheese. In the first part, you are required to write a set function ...