new EventEmitter().on("event", array.push)
为什么会出现意外
let array = [];
let a = new EventEmitter();
a.on("event", array.push);
a.emit("event", 123);
setTimeout(console.log, 1000, array);
Expect: [123]
Actual: []
但是,将a.on("event", array.push);
替换为a.on("event", (a) => { array.push(a); });