I have seen some functions defined as function(){} and some functions defined as () => {}.
Is this related to Javascript version ES6?
Also, how does use of this keyword change from one function definition to another?
I have seen some functions defined as function(){} and some functions defined as () => {}.
Is this related to Javascript version ES6?
Also, how does use of this keyword change from one function definition to another?
The () => {} is called an arrow function. They are, as you said, part of ES6. From the linked page:
An arrow function expression has a shorter syntax compared to function expressions and lexically binds the
thisvalue (does not bind its ownthis,arguments,super, ornew.target). Arrow functions are always anonymous.