advent-of-code/2021/day01.js

5 lines
174 B
JavaScript
Raw Normal View History

2021-12-02 19:59:48 +01:00
let total = 0;
$("pre").innerText.trim().split("\n").map(el => Number(el)).reduce((prev, current) => {if (prev < current) {total += 1} return current});
console.log(total);