Tell us what’s happening:
I’m still working on the final test case (AllThe-small Things), but I’m utterly perplexed by the second test case because when I console.log this test case I seem to pass. So what am I missing?
I have some ideas but I’m still figuring out how best to implement them a solution strategies:
- I need to cleanse the string of all potential punctuation so I can release it all with just dashes in between words
2.I need to include another parameter in split besides the regex. For example, using a comma separation to include another parameter…(sounds the least useful but I wanted to mention it as something I’m considering)
3.Use replace()
Am I onto the right trajectory with any of these?
Your code so far
function spinalCase(str) {
var strNew = str.toLowerCase().split(/[^a-z$]/g).join('-');
console.log(strNew);
return strNew;
}
spinalCase('This Is Spinal Tap');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case/