Hey guys, I’ve been doing the intermediate algorithm challenges and I finished like 5-6 algorithms today and I am here at this Spinal Tap Case algorithm. I am clear of what the algorithm has to do, but what I am having no Idea is how can I detect a word? I mean, if they had something like “hello world”, then I can detect using the special white space character, but how can I fix this if they give me “helloworld” how do I know if it is a word or not and how long it is?
This is what I coded
function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
return str.toLowerCase().replace(/\s/g, "-");
}
spinalCase('thisIsSpinalTap');