← Back to challenges

The Forbidden Letter

JavaScriptHardarraysstringsloopsvalidation

Instructions

Given a letter and an array of words, return whether the letter does not appear in any of the words.

Examples

forbiddenLetter("r", ["rock", "paper", "scissors"]) ➞ false

forbiddenLetter("a", ["spoon", "fork", "knife"]) ➞ true

forbiddenLetter("m", []) ➞ true

Notes

  • All inputs given will be in lowercase.
  • You will always be given a forbidden letter, but there may be empty arrays.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Array Index