javascript beat 100%
\nvar longestWord = function(words) { \n    let set = new Set(words);\n    let res = "";\n    words.forEach(a => {\n        if(a.length < res.length) return;\n 
```\nvar longestWord = function(words) { \n    let set = new Set(words);\n    let res = "";\n    words.forEach(a => {\n        if(a.length < res.length) return;\n        if(a.length == res.length && a > res) return;\n        for(let i = a.length - 1; i> 0 ; i--) {\n            if( !set.has( a.substring(0, i))) return\n            \n        }\n        res = a;\n    })\n    return res;\n};\n```
[]