#JavaScript #Functional Programming #Productivity

First-class and Higher Order Functions: Effective Functional JavaScript

Functions: the killer JavaScript feature we never talk about. JavaScript is a very in-demand language today. It runs in a lot of places from the browser to embedded systems and it brings a non-blocking I/O model that is faster than others for some types of applications. What really sets JavaScript apart from the rest of scripting languages is its highly functional nature. JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. ...

#JavaScript #Functional Programming #Productivity

Closures, Partial Application and Currying: Effective Functional JavaScript

Spices and other ingredients of a great curry To use JavaScript to its full potential you have to embrace its strong functional programming base. We’re going to explore some crucial and powerful functional constructs: closures, partial application and currying that make JavaScript terse yet understandable. The basics Functional programming is a programming paradigm that follows a more mathematical computation model. Let’s go through some basics to make your JavaScript more functional. ...

#Productivity #JavaScript

10 minute JavaScript: Library development in ES6 with Babel, Mocha and npm scripts

JavaScript has a thriving ecosystem of libraries delivered as packages on npm. Node has a high degree of compatibility with ES6 but it doesn’t have some features yet, namely import. This means that if we want to distribute useable packages over npm and we want to be writing ES6, we have to transpile back to ES5. We’ll be setting up a project that allows us to write ES6, and distribute it in ES5 (with Babel) and to test it with Mocha, all through npm scripts. ...

#JavaScript #ES6 #web development

Recursion in JavaScript with ES6, destructuring and rest/spread

The latest ECMA standard for JavaScript (ECMAScript 6) makes JavaScript more readable by encouraging a more declarative style with functional constructs and new operators. Destructuring One of my favourite ES6 features is destructuring. It allows you to extract data from one variable to another by using structure. For arrays this means for example: var [first, second] = [1, 2, 3, 4]; // first: 1 // second: 2 There’s more you can do, like skip some members of the array on the right-hand side of the operation. ...