QUESTION IMAGE
Question
define a setter function named wonaward () that takes a parameter for the name of an award and pushes the end of the awards array.
1 // code will be tested with a different movie
2 let movie = {
3 title: \forrest gump\,
4 director:
obert zemeckis\,
5 composer: \alan silvestri\,
6 budget: 55000000,
7 boxoffice: 677900000,
8 awards: ,
9 movie.wonaward = function(awardname) {
10 this.award.push(awardname);
11 };
error: (line 9) uncaught syntaxerror: failed to execute write on document: unexpected token . the code e provide more details for this error.
note: although the reported line number is in the uneditable part of the code, the error actually exists in your co dont recognize the problem until reaching a later line.
view your last submission
Step1: Analyze the Error
The error is due to incorrect property name in this.award.push(awardName);. The correct property name is awards (plural) as defined in the movie object at line 8 (awards: []).
Step2: Correct the Code
Change this.award.push(awardName); to 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);
};