use array.prototype.findindex polyfill to simplify a line