Skip to content

Instantly share code, notes, and snippets.

View Dviejopomata's full-sized avatar
🏠
Working from home

Dviejo Dviejopomata

🏠
Working from home
  • Alicante, Spain
View GitHub Profile
@Dviejopomata
Dviejopomata / reduce.js
Last active February 23, 2016 12:46 — forked from kutyel/reduce.js
reduce() vs Universe
// 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