Skip to content

Instantly share code, notes, and snippets.

Last active Nov 16, 2017
What would you like to do?
Showcasing the power of arrow functions.
//Arrow Functions
console.log(identity); //Undefined - Function is not hoisted
var identity = x => x ;
console.log(identity); //Function or x => x
//console.log(new identity()); //Error - not a constructor
//Context Example
function test2() {
console.log(this); //test2 - this refers to the object
var test3 = x => console.log(this);
function test4() {
test3(); //Refers to test2
var b = new test4(); //Refers to test4
var a = new test2();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment