Pregunta de entrevista de Wunderkind

Write a JS function that mimics the functionality of indexOf