From 3700a9063725b001267730d6586d9cf905476cbb Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 7 Dec 2020 22:53:36 +0100 Subject: day3 --- day3/day3-1.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 day3/day3-1.js (limited to 'day3/day3-1.js') diff --git a/day3/day3-1.js b/day3/day3-1.js new file mode 100644 index 0000000..401ac7f --- /dev/null +++ b/day3/day3-1.js @@ -0,0 +1,9 @@ +const data = require('./data') + +let trees = 0; +data.forEach((line, i) => { + line[(3 * i)%line.length] === "#" && (trees += 1) +}) + +console.log(trees) + -- cgit v1.2.3