Hey I like the idea of this article, but I do have a couple of comments:
The execution time of your function is heavy if values is large, basically making the execution time O(array.length * values.length). An O(array.length) implementation might look like:
I find it odd to declare a top level function as a "fat-arrow". It's building something to capture global this and that's wasteful. It requires that you declare functions in sequence, which can become a pain and it's just not clear to me that a const is a function - plus who knows how this gets highlighted - but code pen didn't work out it was a function.
Making new arrays all the time has a significant impact on memory and execution time through garbage collection. I get immutability is an important style for reducing complexity, but sometimes it worries me to hell when a developer is taking a temporary array from the previous step and making yet another one.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey I like the idea of this article, but I do have a couple of comments:
values
is large, basically making the execution time O(array.length * values.length). An O(array.length) implementation might look like:I find it odd to declare a top level function as a "fat-arrow". It's building something to capture global
this
and that's wasteful. It requires that you declare functions in sequence, which can become a pain and it's just not clear to me that a const is a function - plus who knows how this gets highlighted - but code pen didn't work out it was a function.Making new arrays all the time has a significant impact on memory and execution time through garbage collection. I get immutability is an important style for reducing complexity, but sometimes it worries me to hell when a developer is taking a temporary array from the previous step and making yet another one.