Timeline for Fastest way to move first element to the end of an Array
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 18, 2018 at 8:35 | comment | added | BoDeX |
note that splice() returns an array so the test called "splice-push" (my personal preference) is not 100% correct. Should be: var b = arr.splice(0, 1); arr.push(b[0]);
|
|
Dec 4, 2013 at 22:00 | history | edited | epascarello | CC BY-SA 3.0 |
added 133 characters in body
|
Dec 4, 2013 at 21:59 | comment | added | epascarello | I updated my answer with ways to do it and a JSPerf. I am sure my loop answer can be improved, I just threw it together as a break from my real work. | |
Dec 4, 2013 at 21:42 | history | edited | epascarello | CC BY-SA 3.0 |
added 647 characters in body
|
Dec 4, 2013 at 21:37 | history | edited | epascarello | CC BY-SA 3.0 |
added 647 characters in body
|
Dec 4, 2013 at 21:07 | comment | added | j08691 | @user2815780 - Perhaps you should post what you've already tried in your question, including stats to show what's fast and slow? | |
Dec 4, 2013 at 21:06 | comment | added | epascarello | Than say that in your question! | |
Dec 4, 2013 at 21:06 | comment | added | Bosiwow | I wanted to avoid the use of shift since it's pretty slow. | |
Dec 4, 2013 at 21:02 | history | answered | epascarello | CC BY-SA 3.0 |