AdventOfCode2020/day_1/task_1.js
2020-12-05 11:35:52 +01:00

11 lines
323 B
JavaScript

const fs = require('fs');
const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8');
const arr = file.split('\n');
arr.forEach(num => {
arr.forEach(num2 => {
if (Number(num) + Number(num2) == 2020) {
console.log(`Found match: ${num} + ${num2} (${num * num2})`);
}
});
});