Question: Javascript ES6 3. Use the .reduce() method on the marvel array to return the count of villains (5) A character is considered a villain when

Javascript ES6

Javascript ES6 3. Use the .reduce() method on the marvel array to

3. Use the .reduce() method on the marvel array to return the count of villains (5) A character is considered a villain when the object has a key hero with a value of false. The output should use a template literal to print: 'Total Villains Count: n' where n is the count of the villains. const marvel = [ { name: 'Spider-Man', hero: true }, { name: 'Thor', hero: true }, { name: 'Thanos', hero: false }, { name: 'Black Panther', hero: true }, { name: 'Loki', hero: false }, { name: 'Captain Marvel', hero: true }, { name: 'Silver Surfer', hero: true }, { name: 'Magneto', hero: false }, { name: 'Venom', hero: false } EXPECTED OUTPUT (string): 'Total Villains Count: 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!