temp-aoc-2023/one/one.js

14 lines
288 B
JavaScript
Raw Permalink Normal View History

2023-12-03 12:59:27 +00:00
import fs from "node:fs";
let data = fs.readFileSync("input", "utf8");
let lines = data
.split("\n")
.map(l => l.split("").filter(c => +c == c))
.map(l => [l[0], l[l.length - 1]])
.map(l => l.join(""))
.map(n => Number(n))
.reduce((acc, n) => acc + n);
console.log(lines);