Tell us what’s happening:
I’m unable to pass this test case
" spinalCase("thisIsSpinalTap") should return the string this-is-spinal-tap"
How to convert non-spaced sentence with ’ - ’ ??
I’m getting this O/p : - thisisspinaltap
Your code so far
function spinalCase(str) {
let space = (/\s+|_+/g);
let string = str
.replace(space,"-")
.toLowerCase();
return string;
}
console.log(spinalCase('thisIsSpinalTap'));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Spinal Tap Case
it would be helpefull if you can share your output ,
however i don’t think you’re changing the string since there’s no white space to replace with “-” , instead you should find a way to split the string into words where there’s a upper case letter and then join it by hyphens and change it lower case.