map every second character jaavascript

Solutions on MaxInterview for map every second character jaavascript by the best coders in the world

showing results for - "map every second character jaavascript"
Lorenzo
29 Oct 2019
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));
similar questions
queries leading to this page
map every second character jaavascript