← Back to challenges

Return the Four Letter Strings

JavaScriptHardstringsarraysvalidationconditions

Instructions

Create a function that takes an array of strings and returns the words that are exactly four letters.

Examples

isFourLetters(["Tomato", "Potato", "Pair"]) ➞ ["Pair"]

isFourLetters(["Kangaroo", "Bear", "Fox"]) ➞ ["Bear"]

isFourLetters(["Ryan", "Kieran", "Jason", "Matt"]) ➞ ["Ryan", "Matt"]

Notes

You can expect valid strings for all test cases.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Maximum Difference