← Back to challenges

Superheroes

JavaScriptHardarraysregex

Instructions

Create a function that takes an array of superheroes / superheroines names and returns an array of only superheroe names ending in "man". Return the names in alphabetical order.

Examples

superheroes(["Batman", "Superman", "Spider-man", "Hulk", "Wolverine", "Wonder-Woman"])
➞ ["Batman", "Spider-man", "Superman"]

superheroes(["Catwoman", "Deadpool", "Dr.Strange", "Captain-America", "Aquaman", "Hawkeye"])
➞ ["Aquaman"]

superheroes(["Wonder-Woman", "Catwoman", "Invisible-Woman"])
➞ []

Notes

Wonder-Woman, Catwoman and Invisible-Woman are superheroines.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Grab the Numbers