JSFiddle - React, Tailwind, and code Playground
JavaScript
var arr = [
"<a href=\"...\" target=\"_blank\">foo</a>",
"<a href=\"...\" target=\"_blank\">apple</a>",
"<a href=\"...\" target=\"_blank\">cucumber</a>"
]
function compFunc(a,b){
return a.match(/>(.*)</)[1] > b.match(/>(.*)</)[1];
}
console.log(arr.sort(compFunc))