118
Array methods (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] swnt@feddit.de 52 points 1 year ago

While the idea and visualisation is indeed good, there is an error in the visualization.

Namely, the meaning of "->" is inconsistent. IMO it should be the return value of the function call (like in reverse), but for at least pop, the visualization shows the array instead of the array + return value.

For pop the return value isn't the array itself, but the popped value: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop

The visualisation could be improved by clarifying, that the array after the function call is visualised. And using -> isn't the best option IMO, because people expect the right side to contain the return value.

[-] Pyro@programming.dev 14 points 1 year ago

I agree, there should be a distinction between return value and array state.

this post was submitted on 26 Sep 2023
118 points (88.3% liked)

JavaScript

1700 readers
1 users here now

founded 1 year ago
MODERATORS