Tell us what’s happening:
There are two tests not passing and i understand why and even theoretically how to fix them
My issue is as such… should i just be building two very case specific solutions into the otherwise reusable code i wrote to solve this problem…
or is it that there is some kind of way of writing this to include solutions for the two test cases while maintaining the “versatility” of my current codes, “flow”.
let me know if i need to get more specific with what im asking>.!!??.
Your code so far
function spinalCase(str) {
str = str.toLowerCase()
let newStr = str.replace(/[^a-z0-9]/gi, ' ');
let arr = newStr.split(" ")
console.log(arr)
}
spinalCase("thisIsSpinalTap")
spinalCase('This Is Spinal Tap');
spinalCase("The_Andy_Griffith_Show")
spinalCase("AllThe-small Things")
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Spinal Tap Case
Link to the challenge: