Good remark! It turns out that
map() calls the mapping function with more arguments than we expect. The first argument is the element in the array and the second one is the element index. Take a look at the
toInt() mapping function:
const numbers = ['1','2','3','4','5','6'];
I will update the book with this information.
I hope the book is useful to you.
Hi! I made a jsperf test comparing functional closure generators with chaining array methods. I processed a collection of 100 000 to-dos and took the first 100. You can take a look.
Take in consideration that
books stores a
List immutable data structure from Immutable.js. Using push() on
books will result in a new
List. Any update on the
List immutable collection results in a new
), then yes
push() would be impure, making the whole function impure.
OK. I can go and study the prototype inheritance and that will help me to better understand the prototype system and
this. What about someone new, that starts to learn the language, what should I tell him:
Over the years, developers put a lot of effort into trying to understand and fix
this related problems. This article is about taking a step back and thinking about what will happen if we removed
this from our code. What if we put the effort in another direction.