Share your repls and programming experiences

← Back to all posts
hahaah
GabriellRibeiro (0)

var myString = "bananona"

function transformingString(value) {
let myArray = value.split("")
let newArray = []

for(let i = 0; i < myArray.length; i++) {
if(i % 2 == 0) {
newArray.push(myArray[i].toUpperCase())
} else {
newArray.push(myArray[i])
}
}

console.log(newArray.join(""))
}

transformingString(myString)