Answers for "js array find regex"

0

js array find regex

const array = ["page=4", "sortOrder=asc", "datePosted=all-time", "sortOrder=desc"];
const match = array.find(value => /^sortOrder=/.test(value));
// match = "sortOrder=asc"
Posted by: Guest on September-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language