Answers for "sort array by object field js"

1

how to sort an array of objects by a property value in javascript

let x = list.sort((a, b) => (a.name > b.name ? 1 : -1));
Posted by: Guest on June-06-2021
0

sort array by field

function cmp($a, $b)
{
    return strcmp($a["title"], $b["title"]);
}

usort($array, "cmp");
Posted by: Guest on December-16-2019

Code answers related to "sort array by object field js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language