To begin with, this is enough:
let total = 0;
let numbers_counter = 0;
process.stdin.on('data', data => {
numbers_counter++;
total += parseInt(data);
if (numbers_counter == 2) {
process.stdout.write(total.toString(), () => {
return process.exit()
});
}
})
And I think this is simpler:
let total = 0;
let numbers_counter = 0;
process.stdin.on('data', data => {
numbers_counter++;
total += parseInt(data);
if (numbers_counter == 2) {
process.stdout.write(total.toString());
process.exit();
}
})
Perhaps you will pass if you don't exit the process?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…