我怎样才能让 addEventListener() 里面有两个函数?
最佳答案
将函数包装在一个函数中。
const invokeMe = () => console.log('I live here outside the scope');
const alsoInvokeMe = () => console.log('I also live outside the scope');
element.addEventListener('event',() => {
invokeMe();
alsoInvokeMe();
});
关于javascript - addEventListener 两个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25028853/