Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  171] [ 3]  / answers: 1 / hits: 66381  / 10 Years ago, wed, july 30, 2014, 12:00:00

How can I make it so that addEventListener() has two functions inside it?


More From » function

 Answers
11

Wrap your functions in a function.



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();
});

[#69999] Sunday, July 27, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jayden

Total Points: 108
Total Questions: 109
Total Answers: 107

Location: Kenya
Member since Mon, Jun 14, 2021
3 Years ago
;