Day 6: fix readability+logic issue
This commit is contained in:
parent
2309c0f348
commit
6a406103bb
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user