Skip to content

Instantly share code, notes, and snippets.

@carbide-public
Created March 25, 2019 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carbide-public/2586a4541a24317a7f639d718b6c73ff to your computer and use it in GitHub Desktop.
Save carbide-public/2586a4541a24317a7f639d718b6c73ff to your computer and use it in GitHub Desktop.
untitled
const a = {
date: 1,
meta: {
a: 1
}
}
const b = {
date: 1,
meta: {
a: 2
}
}
const c = {
date: 1,
meta: {
a: 3
}
}
const arr = [a,b,c]
// const sorter = (a,b) => a.date > b.date ? 1 : -1
const sorter = (a,b) => a.date - b.date
arr.sort(sorter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment