Intermediate Algorithm Scripting - Spinal Tap Case

Tell us what’s happening:
This is how I solved this problem but it’s completely different than the solutions. Anything wrong with how I complete the algorithm?

Your code so far

function spinalCase(str) {
  let spinalCaseRegex = /\w[a-z]+/g
  let result = str.match(spinalCaseRegex)
  return result.join("-").toLowerCase();

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/ Safari/537.36

Challenge: Intermediate Algorithm Scripting - Spinal Tap Case

Link to the challenge:

Since your code passes, I added spoiler tags.

1 Like

other than the fact that it is genius? Nope! :grinning:

1 Like

Doesn’t seem sporting to add a new test case though… :wink:

1 Like

haha tysm! I’m solving a lot of these questions in a different way than the solution. Would you recommend that I try to do it the solution way instead? The solution always seems to be completely different from how I solve it so I’m not sure if what I’m doing is wrong or right.

It is good that you are comparing and contrasting. But do your own thing, that’s your super-power. (So long as you are meeting the objectives that are laid out)

1 Like

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