[Javascript2] fine-tuning of removeArticles

This commit is contained in:
Nicola Clark 2025-04-06 22:27:29 -05:00
parent c8ab1a7b3c
commit 0a8355c190
Signed by: nicola
GPG Key ID: BEF8036296D094BF

View File

@ -20,11 +20,11 @@ const bands = [
* @returns {string} the band name with articles removed
*/
function removeArticles(band) {
if (band.substring(0, 3) === 'The') {
if (band.substring(0, 4) === 'The ') {
return band.substring(4);
} else if (band.substring(0, 1) === 'A') {
} else if (band.substring(0, 2) === 'A ') {
return band.substring(2);
} else if (band.substring(0, 2) === 'An') {
} else if (band.substring(0, 3) === 'An ') {
return band.substring(3);
}