QUESTION IMAGE
Question
define a setter function named wonaward () that takes a parameter for the name of an award and pushes the award name onto the end of the awards array.
// code will be tested with a different movie
let movie = {
title: \forrest gump\,
director:
obert zemeckis\,
composer: \alan silvestri\,
budget: 55000000,
boxoffice: 677900000,
awards: ,
/ your solution goes here /
};
Step1: Define the setter function
In JavaScript, we can define a function named wonAward that takes a parameter awardName.
movie.wonAward = function(awardName) {
Step2: Push the award name
Use the push method to add the awardName to the awards array.
this.awards.push(awardName);
};Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
movie.wonAward = function(awardName) {
this.awards.push(awardName);
};