Sam and Frodo need to be close. If they are side by side in the array, your function should return true. If there is a name between them, return false.
middleEarth(["Frodo", "Sam", "Gandalf"]) ➞ true
middleEarth(["Frodo", "Saruman", "Sam"]) ➞ false
middleEarth(["Orc", "Sam", "Frodo", "Legolas"]) ➞ true
true if Frodo and Sam are side by side.