How to include => with .on function?

I saw something on a tutorial page with => but on my side not want to work what I miss?


I do not see you are using => in your code anywhere. If you do not understand how to use =>, check out the ES6 section of the curriculum regarding arrow functions.

the arrow function works as follows:

(args) => {
//your code here

where args is your arguments it’s also called the arrow function or anonymous function, it works just as any other function but it’s anonymous, you’ll find it very useful to use with .map(), .filter()…etc

you can assign it a name as follows:

let myfunction = (args)=>{

you can read more here: