Tell us what’s happening:
It keeps telling me that I have an infinite loop. I don’t see it. Any help would be appreciated.
Your code so far
function spinalCase(str) {
var thing = str.split("");
for ( i =1; i< thing.length; i++){
for (j = 0; j< thing.length; j++){
if ( thing[i] == thing[i].toUpperCase() && thing[j] != " "){
thing.splice(thing[j], 0, " ");}}}
var newThing= thing.join("");
newThing = newThing.replace(/[\s_]/g, "-");
newThing= newThing.toLowerCase();
return newThing; }
spinalCase('AllThe-small Things');
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Linux; Android 7.0; LGMP260 Build/NRD90U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/spinal-tap-case