Horje
javascript sort array by Z-A in js Code Example
javascript sort array by Z-A in js
// Price Low To High
array?.sort((a, b) => (a.price > b.price ? 1 : -1))
// Price High To Low
array?.sort((a, b) => (a.price > b.price ? -1 : 1))
// Name A to Z
array?.sort((a, b) => (a.name > b.name ? 1 : 1))
// Name Z to A
array?.sort((a, b) => (a.name > b.name ? -1 : 1))
// Sort by date
array.sort((a,b) =>  new Date(b.date) - new Date(a.date));




Javascript

Related
load jquery in html Code Example load jquery in html Code Example
javascript sort array by A-Z in js Code Example javascript sort array by A-Z in js Code Example
javascript check if undefined or null Code Example javascript check if undefined or null Code Example
page reload timeout Code Example page reload timeout Code Example
jquery when you typing in input Code Example jquery when you typing in input Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9