map every second character jaavascript code example
Example: map every second character jaavascript
var str = 'hello world how ya doing?';
function toUpperCase(str) {
return str.split('').map((v, i) => i % 2 == 0 ? v.toLowerCase() : v.toUpperCase()).join('');
}
console.log(toUpperCase(str));