Skip to content

Instantly share code, notes, and snippets.

Dviejo Dviejopomata

  • Alicante, Spain
View GitHub Profile
@Dviejopomata
Dviejopomata / reduce.js
Last active Feb 23, 2016 — forked from kutyel/reduce.js
reduce() vs Universe
View reduce.js
// reduce() awesomeness
var a = [1, 2, 3, 4, 5, 5, 3];
var b = [{key: 1, value: 'a'}, {key: 2, value: 'b'}];
var c = [promise1, promise2, promise3...];
// Max
a.reduce((x, y) => x > y ? x : y); // 5
// Min
a.reduce((x, y) => x < y ? x : y); // 1
You can’t perform that action at this time.