Given a string change the every second letter to an uppercase
var str = 'hello world how ya doing?';
console.log(toUpperCase(str));
function toUpperCase(str){
var words = str.split(' ');
var uppers = words.map(function(val, i) {
if(i%2 == 0)
return (val + "").toLowerCase();
else
return (val + "").toUpperCase();
});
return uppers.join(' ');
}