← Back to challenges

Between Words

JavaScriptHardstringsvalidation

Instructions

Write a function that takes three string arguments (first, last, and word) and returns true if word is found between first and last in the dictionary, otherwise false.

Examples

isBetween("apple", "banana", "azure") ➞ true

isBetween("monk", "monument", "monkey") ➞ true

isBetween("bookend", "boolean", "boost") ➞ false

Notes

  • All letters will be in lowercase.
  • All three words will be different.
  • Remember that the string word is in the middle.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Regex Series: String Contains at Least One Digit