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"
Also in JavaScript:
- running scripts is disabled on this system react js
- how to run cypress test
- javascript loop through object
- Create MD5 hash with Node.js
- javascript is int in array
- js set iframe src
- vue config devtools
- format JSON code javascript
- download datepicker js
- ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: [object Object]'. Current value: 'ngIf: true'.
- define two variables in one line javascript
- shift js mdn
- how to remove duplicates in array in javascript
- open bytes in new tab angular
- react native vector icons
- how to set time out in js
- redirect using javascript
- javascript the difference between innerText vs. innerHTML vs. textContent
- how to get a channelid discord.js
- check if number appears odd number of times in array javascript
- javascript detect square number
- js queryselectorall
- react router redirect
- js should i use try catch