Created
October 8, 2018 18:06
-
-
Save krmax44/e5a90f13acea5a922c5736cad136463c to your computer and use it in GitHub Desktop.
Horribly inefficient solution, but it's only one line of code!
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
// words.txt: https://github.com/dwyl/english-words/blob/master/words.txt | |
// see this video for why this exists: https://www.youtube.com/watch?v=zp4BMR88260 | |
console.log(require('fs').readFileSync('words.txt').toString().split('\n').filter(word => /^[abcdefhijlnoprstu\-y. ]*$/.test(word.toLowerCase())).sort((a,b) => a.length < b.length ? 1 : -1)[0]); | |
// output: dichlorodiphenyltrichloroethane |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment