We're a place where coders share, stay up-to-date and grow their careers.
Indeed! Didn't catch that! Here is a little fix for that:
toWeirdCase=(a)=>a.split` `.map(s=>[...s].map((e,i)=>i%2?e.toLowerCase():e.toUpperCase()).join``).join` `;
which output is:
toWeirdCase('String'); // "StRiNg" toWeirdCase('Weird string case'); // "WeIrD StRiNg CaSe"
Indeed! Didn't catch that! Here is a little fix for that:
which output is: