Tell us what’s happening:
//I found this code in the solution. what is the use of $1 and $2?
str.replace(/([a-z])([A-Z])/g, “$1 $2”);
Your code so far
function spinalCase(str) {
console.log(str.replaceAll("_"," ").split(" ").join("-"))
}
spinalCase('This Is Spinal Tap');
spinalCase("The_Andy_Griffith_Show");
spinalCase("Teletubbies say Eh-oh");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
.
Challenge: Spinal Tap Case
Link to the challenge: