First we read our input from a text file, then we split our input string into a more workable form: an array of integers. Next using a simple nested loop we can check each integer against every other integer, until we find the pair that sums to 2020, and finally we print the product of that pair to the console.
const fs = require('fs');
const input = fs.readFileSync('input.txt', "utf8").split('\n').map(el => parseInt(el));
input.forEach((num, idx) => {
input.forEach((num2, idx2) => {
if (num + num2 === 2020 && idx !== idx2) {
console.log(num * num2);
}
})
})