Month: May 2016
-
The Most In-Depth Yet Understandable ES6 Destructuring Tutorial (complete with Assembled Avengers)
Destructuring is a new ES6 technique for extracting data from JavaScript objects and arrays using a much tighter, terser, and clearer syntax than that provided by ES5. The result is not just the saving of a few bytes of code; destructuring can change the way you code in radically new ways, and the more you […]
-
How to mock the Date to keep date-based unit tests predictable
When unit testing functions that use the Date.now() function, you’ll need to lock down the value it returns – otherwise, your unit tests will only ever run successfully on the day (or even the minute!) that you run them. This article shows how you can override Date.now() to make it return a predictable value. Step […]