Spinal Tap Case Whats's the promlem with the code?

Spinal Tap Case Whats's the promlem with the code?
0

#1

Tell us what’s happening:

just tested it on codepen, and this code passes al the tests, while FCC compilator keeps saying that i dont pass some chalengies. What’s wrong?

Your code so far


function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  let newArr=str.toLowerCase()
  .split(/\W+/)
  .join('-');
  return newArr;
}

spinalCase('This Is Spinal Tap');

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case


#2

This doesn’t pass 3 of the tests.
“thisIsSpinalTap”, “The_Andy_Griffith_Show” & “AllThe-small Things”

As 2 don’t contain a non-alphanumerical characters and \W does not select underscores.
Check the hints, there’s some good suggestions there on what logic to follow


#3

yep, already passed the task, thats just my carelessness. Also Marked the post to be deleted, cuz i dont have the rights to delete it) was very self-confident to guess that the compilator is wrong)