diff options
author | Elizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz> | 2023-12-01 15:49:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 15:49:11 -0700 |
commit | cdb12dbc28cc441745bad55e384494bc8942586a (patch) | |
tree | c0be1ce91bc908e29b6f1eb67b29f6053af71ff6 /aoc_2023/day0/main_1.js | |
parent | dd297be17d94f59a856add6dc7cd4c446225e099 (diff) | |
download | aoc-cdb12dbc28cc441745bad55e384494bc8942586a.tar.gz aoc-cdb12dbc28cc441745bad55e384494bc8942586a.zip |
Template (#1)
* tempalte foo
* buff aoc stuff
Diffstat (limited to 'aoc_2023/day0/main_1.js')
-rw-r--r-- | aoc_2023/day0/main_1.js | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/aoc_2023/day0/main_1.js b/aoc_2023/day0/main_1.js deleted file mode 100644 index aa00ffe..0000000 --- a/aoc_2023/day0/main_1.js +++ /dev/null @@ -1,18 +0,0 @@ -const fs = require("node:fs"); - -const data = fs.readFileSync("input.txt", "utf8"); - -const res = data - .split("\n") - .filter((line) => line && line != "") - .map((line) => line.replaceAll(/[^0-9]*/g, "")) - .reduce((acc, line) => { - const nums = line.split(""); - - const first = parseInt(nums.at(0)); - const last = parseInt(nums.at(-1)); - - return acc + (first * 10 + last); - }, 0); - -console.log(res); |