Day 6: fix readability+logic issue

This commit is contained in:
Alice Gaudon 2020-12-06 14:07:13 +01:00
parent 2309c0f348
commit 6a406103bb
1 changed files with 3 additions and 3 deletions

View File

@ -18,10 +18,10 @@ fs.readFile('input.txt', (err, data) => {
for (const question of person) {
if (q1Questions.indexOf(question) < 0) {
q1Questions.push(question);
}
if (group.every(person => person.indexOf(question) >= 0)) {
q2Questions.push(question);
}
if (q2Questions.indexOf(question) < 0 && group.every(person => person.indexOf(question) >= 0)) {
q2Questions.push(question);
}
}
}