Created
December 31, 2019 00:15
-
-
Save risingBirdSong/eb20e9f8d4a4b51387a64f6b57a531bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function duplicateEncode(word){ | |
return word | |
.toLowerCase() | |
.split('') | |
.map( function (a, i, w) { | |
return w.indexOf(a) == w.lastIndexOf(a) ? '(' : ')' | |
}) | |
.join(''); | |
} | |
//my solution worked but i like this better, from another code warrior |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment