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};