Intermediate Algorithm Scripting - Spinal Tap Case

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:

PS. Also ik my code is not yet completed or even returning a solution
Im kinda parking my “thought car” here and waiting on an answer… haha…
i need a burnout pause anyway

potentially i like this critique
how would i go about “entirely re-conceptualizing” the way i have coded this…
i ask because i sometimes find it wildly difficult to change perspective without a nudge in the direction that puts me out of the ditch i’ve thought myself into

In Short… Please Elaborate?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.