Edd Mann Developer

Arrow Functions Lexical 'this' Scoping in JavaScript

One feature of ES2015 that I feel can be a stumbling block (but extremely useful) is Arrow Functions lexical scoping of this. Before this addition, every new function defined its own this - meaning we were required to explicitly bind or locally store the this reference that we desired in many use-cases.

Mimicking Named Parameters in JavaScript

Whilst working today I came across a test helper function that required a few too many parameters. Debating weather to break the function up, I decided that an elegant solution would be to take advantage of ES2015 object deconstruction and produce a form of ‘Named Parameters’.

Using Multiple Arrays with array_map in PHP

Today I stumble upon some code that I did not realise was possible with an array_map function in PHP. You are able to supply multiple arrays, which in turn will get ‘zipped up’ and passed to the supplied callback as parameters. This allows for some rather elegant solutions to the ‘index issue’ and accessing keys from within the callback - both of which are easily achieved in an impertivive mindset.