Whenever i want to convert string in to array editor displays this message: TypeError:str.spilt() is not function
My program:
function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
var arr =str.spilt('');
}
spinalCase('This Is Spinal Tap');
function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
var arr =str.spilt('');
for(var i=1;i<arr.length;i++){
if(str[i]==str[i].toUpperCase()){
arr.splice(i,0,"-");
}
else if(str[i]=='_'){
arr.splice(i,1,"-");
}
else if(str[i]==' '){
arr.splice(i,1,"-");
}
}
str1 = arr.join('');
str1 = str1.toLowerCase();
return str1;
}
spinalCase('This Is Spinal Tap');
```
Always check for typos is good coding rule of thumb. Code editor in FCC colors functions (red, I think) so if you type stuff wrong it will likely be the wrong color.