Keyboard Row Lab
Easy
25
56.0% Acceptance
In this lab, you will be working with a function called findWords()
. This function takes an array of strings words
as input and returns the words that can be typed using letters of the alphabet on only one row of the American keyboard.
In the American keyboard:
- the first row consists of the characters
"qwertyuiop"
, - the second row consists of the characters
"asdfghjkl"
, and - the third row consists of the characters
"zxcvbnm"
.
Your task is to implement the findWords()
function using the provided initial code in index.js
and pass the challenges given below. Your code will be evaluated based on these challenges, so make sure to carefully read and understand the requirements of each challenge.
Examples:
findWords(["Hello", "Alaska", "Dad", "Peace"]); // Output: ["Alaska", "Dad"] findWords(["omk"]); // Output: [] findWords(["adsdf", "sfd"]); // Output: ["adsdf", "sfd"]
Constraints:
1 <= words.length <= 20
1 <= words[i].length <= 100
words[i]
consists of English letters (both lowercase and uppercase).
Challenges
- Export the
findWords
function correctly from yourindex.js
file. - Implement the
findWords()
function that passes the given test cases. - Make sure your code is bug-free and handles edge cases properly.
- Make sure you're exporting the default function