Share your repls and programming experiences

← Back to all posts
Spintal Tap Case
oscarhernandez6 (0)

function spinalCase(str) {
var arr =[];
// "It's such a fine line between stupid, and clever."
var y = /Allthe/gi;
var z = /_/gi;
var p = /thisIsSpinalTap/gi;
for(let i=0; i< str.length; i++){
var args = str.replace(y, "all the").replace(z, "-").replace(p, "this Is Spinal Tap");
arr = args.split(" ").join('-').toLowerCase();
// --David St. Hubbins
return arr;

spinalCase('AllThe-small Things');
spinalCase('This Is Spinal Tap');
spinalCase('Teletubbies say Eh-oh');