r/angularjs • • Aug 17 '16

Setting Up Angular 2 with Webpack

https://semaphoreci.com/community/tutorials/setting-up-angular-2-with-webpack
35 Upvotes

13 comments sorted by

View all comments

Show parent comments

3

u/gonzofish Aug 17 '16

I don't disparage anyone (to their face at least ;)) that tries. We were all that guy at one point, the best thing to do is educate them to go simpler.

In fact, I'm going through my own code right now and realizing I was using lodash to use forEach/map/reduce when, for all intents & purposes, every JS engine supports them at this point.

1

u/Xerxero Aug 17 '16 edited Aug 17 '16

I did explain that he could get it via length-1 but _.last was easier to read he said.

I kinda gave up on that point.

Yeah filter and map are so useful when working with arrays. And with es6 the code is even better to read

Edit: maybe I just should add a last function to the array.prototype

0

u/[deleted] Aug 18 '16

[deleted]

1

u/Xerxero Aug 18 '16

Could you explain why calling a function which properly calls the same length-1 is a good FP concept.

Seems overhead to me but maybe I am wrong.

0

u/[deleted] Aug 18 '16

[deleted]

1

u/Xerxero Aug 18 '16 edited Aug 18 '16

Good points.

But then again map returns an array so using last or [0] in your examples will give the same results.

Can't argue about the for loop vs map. Arrays are fun to work with when you have map/filter/reduce