var findWords = function (words) {
let firstRowSet = new Set("qwertyuiop".split(''));
let secondRowSet = new Set("asdfghjkl".split(''));
let thirdRowSet = new Set("zxcvbnm".split(''))
let result = [];
for (let word of words) {
let charSplit = word.toLowerCase().split('')
if (charSplit.every(char => firstRowSet.has(char))) {
result.push(word)
} else if (charSplit.every(char => secondRowSet.has(char))) {
result.push(word)
} else if (charSplit.every(char => thirdRowSet.has(char))) {
result.push(word)
}
}
return result
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)