which is allocating space for a 2 items array N times (worst case). Surely, the browser engine would optimise the code but it would be better to create a helper array and reuse. Also, since the helper function is also an object, should we consider that as memory allocation?
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.
One thing I wonder about space complexity.
You have this
which is transpiled to
which is allocating space for a 2 items array N times (worst case). Surely, the browser engine would optimise the code but it would be better to create a helper array and reuse. Also, since the helper function is also an object, should we consider that as memory allocation?