Eric Blade
Member since Aug 2, 2017
- Profile: /members/13602-eric-blade.htm
- Comments: 4
Recent Blog Comments By Eric Blade
-
I Wish JavaScript Had A Way To Map And Filter Arrays In A Single Operation
Posted on Apr 3, 2019 at 6:52 AM
oops forgot the parseInt in mapFunction, but whatever. you get the idea :-D... read more »
-
I Wish JavaScript Had A Way To Map And Filter Arrays In A Single Operation
Posted on Apr 3, 2019 at 6:51 AM
const filterFunction = (x) => parseInt(x, 10) > 0; const mapFunction = (y) => y+1; const arr = ["0","1","10","20"]; arr.reduce((acc, x) => filterFunction(x) ? acc.push(mapFunction(x)), acc : acc, []);... read more »
-
I Wish JavaScript Had A Way To Map And Filter Arrays In A Single Operation
Posted on Aug 2, 2017 at 11:42 PM
yeah, reduce() is built for this.... read more »
-
The ES6 Promise Constructor And Its Executor Function Are Invoked Synchronously
Posted on Aug 2, 2017 at 11:40 PM
Probably best to point out that the resolve() is actually happening synchronously along with everything else, it's the then() that receives it, that is being handled outside of the main execution.... read more »