Created
December 4, 2017 12:05
-
-
Save jasper-lyons/6b430c16092bde6954c277596ae99e40 to your computer and use it in GitHub Desktop.
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
function onlyUniqueWords(string) { | |
return string.split(' ').reduce(function (arr, word) { | |
if (!arr) return arr; | |
if (arr.indexOf(word) > -1) return false; | |
return arr.concat(word); | |
}, []); | |
} | |
var passPhrases = `pphsv ojtou brvhsj cer ntfhlra udeh ccgtyzc zoyzmh jum lugbnk | |
... | |
juo pmiyoh xxk myphio ogfyf dovlmwm moevao qqxidn`.split("\n"); | |
console.log(passPhrases.map(onlyUniqueWords).filter(Boolean).length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment