550.键盘行

 1/**
2 * @param  {string[]} words
3 * @return {string[]}
4 */

5var findWords = function(words{
6    let rows = ['qwertyuiop''asdfghjkl''zxcvbnm'];
7
8    return words.filter(word => {
9        let wordArr = [...word.toLocaleLowerCase()];
10        return rows.some(row => wordArr.every((v, i) => row.includes(v)));
11    });
12};
posted @ 2018-12-18 16:01  rencoo  阅读(129)  评论(0编辑  收藏  举报