function spinalCase(str) {
let aaa = str.toLowerCase();
let bbb = ""
for(let i=0; i<aaa.length; i++) {
//bbb += aaa[i] === " " ? "-" : aaa[i]
if(aaa[i] === " "){
aaa[i]=== "-"
}
bbb += aaa[i]
}
console.log(bbb);
}
spinalCase('This Is Spinal Tap');
Hello:)
I try to rewrite the ternary operator into if statement. For some reason it is not working. What am I missing?