const array = ["page=4", "sortOrder=asc", "datePosted=all-time", "sortOrder=desc"]; const index = array.findIndex(value => /^sortOrder=/.test(value)); // index = 1;