summaryrefslogtreecommitdiffstats
path: root/day3/day3-1.js
diff options
context:
space:
mode:
Diffstat (limited to 'day3/day3-1.js')
-rw-r--r--day3/day3-1.js9
1 files changed, 9 insertions, 0 deletions
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)
+