Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in javascript Write a function called filterHeros that uses the .filter() method ( 15 pts ) The filterHeros function MUST use the .filter() method The

in javascript

Write a function called filterHeros that uses the .filter() method (15 pts)

The filterHeros function MUST use the .filter() method

The filterHeros accepts an array of objects as an argument

The filterHeros determines which are heros and creates an array of strings that contains only the hero's name

The filterHeros returns the array of hero names.

Example:

filterHeros([ { name: 'Spider-Man', isHero: true }, { name: 'Thor', isHero: true }, { name: 'Thanos', isHero: false }, { name: 'Black Panther', isHero: true }, { name: 'Loki', isHero: false }, { name: 'Captain Marvel', isHero: true }, { name: 'Silver Surfer', isHero: true }, { name: 'Magneto', isHero: false }, { name: 'Venom', isHero: false } ])

EXPECTED OUTPUT (array of strings): ['Spider-Man', 'Thor', 'Black Panther', 'Captain Marvel', 'Silver Surfer']

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

(2) An example of praise that you received badly or indifferently.

Answered: 1 week ago

Question

(1) An example of negative feedback that you received badly.

Answered: 1 week ago

Question

How well do you gain participation and involvement from the group?

Answered: 1 week ago