Assessment wanted for Test your skills: Arrays 4

Once I find the “false” and “true” values of my array items using "startsWith(), how can I connect the “true” values to the correspondents strings in the original array and therefore print the desired result?

The array has [Parrots,Falcons,Emus,Caracaras,Egrets]
and after running:
const map1 = birds.map(bird => ${bird.startsWith("E")});
//output:false,false,true,false,true

and I would like to print only the “true” values which are correspondent to “Emus” and Egrets.

Please see the hard coded solution link bellow, in case of many values this isn’t good, I would like a more effective way to solve this.

code link:

A link to the actual task or assessment page:

Thanks for all the help!!!
Regards,
Dan

Hi @DanFer and welcome to the community :wave:

There’s another array function that has the same format as map() but returns a new array with all the array values where the function is true (Instead of just true/false). It’s called filter(). This would be an ideal tool for this task.

Feel free to ask if you need more help. :slightly_smiling_face:

See you,
Michael

1 Like