Posts

Showing posts from May, 2018

ES6 arrow functions, syntax and lexical scoping

ES2015 (ES6) introduces a really nice feature that punches above its weight in terms of simplicity to integrate versus time saving and feature output. This feature is the arrow function. Before we dive into the features of the arrow function and what it actually does for us, let’s understand what an arrow function is  not . It’s not a replacement for the  function  keyword, at all. This means you can’t do a find and replace on every single  function  keyword and everything works perfectly, because it likely won’t. Table of contents Syntax Hint: arrows are anonymous Syntax: single line expressions Syntax: single argument functions Functionality: lexical scoping “this” If you’re competent with the way  JavaScript scope  works, and have a great understanding of lexical scope, the  this  keyword and Prototype methods such as  .call() ,  .apply()  and  .bind() , then you’re in good hands to continue reading. ...