Sorting Band Names Without Articles

Published by Deep Xavier in

Write a function that sorts the given array of band names discounting the articles "the", "a", "an" if the first word of the band name categorically belongs to.

Examples

sortWithoutArticles(["The New Yardbirds", "The Beatles", "The Square Roots", "On A Friday", "An Irony"])
➞ ["The Beatles", "An Irony", "The New Yardbirds", "On A Friday", "The Square Roots"]

sortWithoutArticles(["The Platters", "A Yard of Yarn", "The Everly Brothers", "A Monster Effect", "The Sex Maggots"])
➞ ["The Everly Brothers", "A Monster Effect", "The Platters", "The Sex Maggots", "A Yard of Yarn"]

sortWithoutArticles(["But Myth", "An Old Dog", "Def Leppard", "The Any Glitters", "The Dawn"])
➞ ["The Any Glitters", "But Myth", "The Dawn", "Def Leppard", "An Old Dog"]

Notes

You have to return the sorted full band names.

Watch a quick demo on how Edabit works.