we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "given a string change the every second letter to an uppercase"
Gabin
26 Jan 2016
1var str = 'hello world how ya doing?';
2
3function toUpperCase(str) {
4  return str.split('').map((v, i) => i % 2 == 0 ? v.toLowerCase() : v.toUpperCase()).join('');
5}
6
7console.log(toUpperCase(str));