How do I find the start of a word?

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, "-");


You won’t detect this as you provided invalid example; take a look again at test cases and you’ll see that words are easily distinguished, e.g. “thisIsSpinalTap” or “AllThe-small Things”. So detecting white spaces in regex will not be enough

You’re right, I might have thought of the test cases as something else.