Skip to content

Instantly share code, notes, and snippets.

@seckBalla
seckBalla / ascendingSort.js
Created November 2, 2018 14:37 — forked from onildoaguiar/ascendingSort.js
Example of functional sorting an object array by name and age
const persons = [
{ 'name':'Luke', 'age':10},
{ 'name':'Leia', 'age':10},
{ 'name':'Vader', 'age':40}
];
const ascending = x => y => x > y;
const ageSort = (x, y) => ascending(x.age)(y.age);
@seckBalla
seckBalla / ascendingSort.js
Created November 2, 2018 14:23
Example of functional sorting an object array by name and age
const persons = [
{ 'name':'luke', 'age':10},
{ 'name':'leia', 'age':10},
{ 'name':'vader', 'age':40}
];
const ascending = x => y => x > y;
const ageSort = (x, y) => ascending(x.age)(y.age);