return arr.map(function (str, index, arr) {
let newStr = ""
let i = 0
while(i<str.length){
if (i !== 0 && (str[i] <= 'Z')) {
newStr += String.fromCharCode(str[i].charCodeAt() + 32)
}else if(i === 0 && (str[i] >= 'Z')) {
newStr += String.fromCharCode(str[i].charCodeAt() - 32)
}else{
newStr += str[i]
}
i++;
return newStr;
})
Sign in to make a reply
Kiah
return arr.map(function (str, index, arr) {
let newStr = ""
let i = 0
while(i<str.length){
if (i !== 0 && (str[i] <= 'Z')) {
newStr += String.fromCharCode(str[i].charCodeAt() + 32)
}else if(i === 0 && (str[i] >= 'Z')) {
newStr += String.fromCharCode(str[i].charCodeAt() - 32)
}else{
newStr += str[i]
}
i++;
}
return newStr;
})