Spinal Tap Case problem

Spinal Tap Case problem
0

#1

I dont understand why this isnt working.

Your code so far

function spinalCase(str) {
  
  var sign = /\s+|_+/g;
  var result;
  
  result='"'+str.replace(sign, "-").toLowerCase()+'"';
  
  
  return result;
}


spinalCase("Teletubbies say Eh-oh");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36.

Link to the challenge:


#2

You have a couple of problems, but first I will help you fix something that is definitely causing trouble.

If you remove skip adding ‘"’ on both ends of the string you assign result in the following line, you will start to pass some of the tests. Then you just need to figure out why a few of the tests are not passing.

 result='"'+str.replace(sign, "-").toLowerCase()+'"';

The reason you need to remove the '"" is because str is already a string. Your solution is adding actual double quotes on both ends of the string, so for the test case

spinalCase("Teletubbies say Eh-oh");

it should have returned ‘teletubbies-say-eh-oh’, but instead returned ‘“teletubbies-say-eh-oh”’