Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

define a setter function named wonaward () that takes a parameter for t…

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 /
};

Explanation:

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);
};

Answer:

movie.wonAward = function(awardName) {
    this.awards.push(awardName);
};