I saw some functions defined as function(){} , and some functions defined as () => {} .
function(){}
() => {}
Is this related to the Javascript version of ES6?
Also, how does the use of the this change from one function definition to another?
this
() => {} is called the arrow function . They, as you said, are part of ES6. On the linked page:
An arrow function expression has a shorter syntax than a function expression and lexically binds this value (does not bind its own this , arguments , super or new.target ). The arrow functions are always anonymous.
arguments
super
new.target