Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Output the sentence Number of actors: followed by the number of actors. Then use a loop to output Actor: { name } , Role:
Output the sentence "Number of actors: followed by the number of actors. Then use a loop to output "Actor: name Role: role for each actor.Output the sentence "Number of actors: followed by the number of actors. Then use a loop to output "Actor:
name Role: role for each actor.
Ex: Given the following actors map, output should be:
Number of actors:
Actor: Elijah Wood, Role: Frodo Baggins
Actor: Orlando Bloom, Role: Will Turner
let actors new Map; Code will be tested with different actors
actors.setElijah Wood", movie: "The Lord of the Rings", role: "Frodo Baggins" ;
actors.setOrlando Bloom", movie: "Pirates of the Caribbean", role: "Will Turner" ;
console. "Number of actors: actors.size;
for let name details of actors
console. Actor: actors Role: details.role;
table
Testing with actors
Yours and expected differ. See highlights below. Special character legend
Number of actors:
Actor: $actors Role: $detailsrole
Yours Actor: $ actors Role: $detailsrole
Actor: $actors Role: $detailsrole
Actor: $ actors Role: $detailsrole
Number of actors:
Actor: Elijah Wood, Role: Frodo Baggins
Expected
Actor: Matthew McConaughey, Role: Cooper
Actor: Orlando Bloom, Role: will Turner
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started