I suspect the problem is that the question as written is not the same as the question you meant to ask. That expression doesn't prepend to an array. Instead, it creates a new array constructed such that its items appear as they would have had you actually done a prepend on the original array.
– OuroborusOct 28 '21 at 19:20
It is a prepend, in that it puts the element on the front of the array. It's the idiomatic way in python, and while it creates a new array, that is also effectively true of javascript as well. O(n) where `n` is the size of the new list.
– Nathaniel FordOct 28 '21 at 20:05
2
destructuring is called unpacking in python and uses a star for lists instead of 3 dots. i.e. ```arrayWithMyNewItem = [mynewitem, *existingarray]```
– bytefaceOct 28 '21 at 21:18
I renamed the question: @byteface thanks for that, I guess that's exactly what I was looking for
– JohnOct 29 '21 at 08:15