Searching for the closest "stop" elements surrounding a start point
There is an overload of .indexOf that takes a second parameter indicating the starting location for the search.  That can be used to find the stop after starthere. Then you can use .slice to grab the part of the array before starthere with lastIndexOf to find the stop that comes before:

var i = arr.indexOf('starthere');
var stopafter = arr.indexOf('stop', i);
var stopbefore = arr.slice(0, i).lastIndexOf('stop');
document.write(stopbefore + '&lt;/br&gt;' + stopafter);