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

View File

@ -18,10 +18,10 @@ fs.readFile('input.txt', (err, data) => {
for (const question of person) { for (const question of person) {
if (q1Questions.indexOf(question) < 0) { if (q1Questions.indexOf(question) < 0) {
q1Questions.push(question); 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);
} }
} }
} }