Arrow functions in JavaScript

Since their introduction arrow function have simplified how we declare functions in JavaScript arrow functions are similar to lambadas in kotlin programming language
Instead of writing a function as
function time (param){
    return Date.now()
}
You can simplify code by rewriting it as simply
let time (param) =>  {
    return Date.now()
}
Alternatively you can use a neatier syntax
let time = param => Date.now()
Arrow functions this context does not refer to their scope.

For further reading "learn es6 the dope way part ii arrow functions and the this keyword",

Comments

Popular posts from this blog

FlappingBird Postmortem (JS13K)

JavaScript introduction to variables

FlappingBird JS13K Games

How to target all elements of a given class name in JavaScript

Zedplug will be decommissioned on November 30th