Wondering why the second function doesn’t work, do I have to redefine str every time instead of just run .replace() or toUpperCase() on str?
function toCamelCase(str){
for(let i = 0; i < str.length - 1; i ++) {
if (str[i] === '-' || str[i] === '_') {
str = str.replace(str[i], '')
str = str.replace(str[i], str[i].toUpperCase())
}
}
return str
}
function toCamelCase(str){
for(let i = 0; i < str.length - 1; i ++) {
if (str[i] === '-' || str[i] === '_') {
str.replace(str[i], '')
str.replace(str[i], str[i].toUpperCase())
}
}
return str
}