Hi all,
I’m confused as to why my code isn’t passing the exercise. When I run the code it seems to output exactly what it is supposed to, but I’m still getting an error. Please can someone shed a light on what is tripping me up here.
function spinalCase(str) {
return str
.replace(/[-_]/, " ")
.split(/(\s|[A-Z][a-z]*)/g)
.map(elem => elem.replace(" ", ""))
.filter(Boolean)
.join('-')
.toLowerCase();
}
console.log(spinalCase("TheAndyGriffith_Show"));
This is giving me this error:
Thanks