I'm trying to efficiently
write a statement that pushes to position 1 of an array, and pushes whatever is in that
position, or after it back a
spot.
array =
[4,5,9,6,2,5]
#push 0 to position 1
array =
[4,0,5,9,6,2,5]
#push 123 to position
1
array =
[4,123,0,5,9,6,2,5]
What
is the best way to write this? (javascript or coffeescript
acceptable)
Thanks!
No comments:
Post a Comment