
Looking through the documentation for String.prototype, the search method looks promising due to its name. Ideally, what we're looking for is a method with a name that matches our intention (determining if x contains y), and returns a simple true or false. That means that we can use it, but the clarity of the code suffers. In the event that no match is found, it will return -1. Its job is to return the index at which a given substring is found.


While indexOf is often recommended as a simple way to test for the presence of a substring, that's not really its purpose.

Var philosophers = "Aquinas, Maimonedes, and Avicenna" var me = "Joshua" function printPhilosopherStatus ( person ) // Outputs: "Joshua is NOT a philosopher." printPhilosopherStatus ( me )
