Created
November 19, 2019 05:22
-
-
Save etoxin/e24a711a40f5289367e06d471f4992eb to your computer and use it in GitHub Desktop.
CodeWars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let p = | |
"The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?"; | |
function toWeirdCase(InputString) { | |
return InputString.split("") | |
.filter(l => l.match(/[a-zA-Z]/)) | |
.map((l, i) => (i % 2 ? l.toLowerCase() : l.toUpperCase())) | |
.join(""); | |
} | |
console.log(toWeirdCase(p)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment