JSFiddle - React, Tailwind, and code Playground

JavaScript

function spinalCase(str) {
var str1;
var arr0=[];
var x = str.indexOf(' ');
arr0=str.split('')
arr0.forEach(
function(item, index){
if (item==='p'){
arr0.splice(index, 1, ' ')}
}
)


// "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  console.log (arr0);
}

spinalCase('thisIsSpinalTap');