capitalization meaningn code example
Example: Alternate capitalization
const capitalize = s => {
s = s.split('')
let finalArr = []
let i = 0
while(i < 2){
let str = ''
s.forEach((letter, index) => {
if(i % 2 === 0 && index % 2 === 0) str += letter.toUpperCase()
else if(i % 2 !== 0 && index % 2 !== 0) str += letter.toUpperCase()
else str += letter
})
finalArr.push(str)
i++
}
return finalArr
};
console.log(capitalize("abcdef"))