JavaScript
-
push vs concat vs for loopJavaScript 2022. 9. 16. 18:25
you're adding a few elements to a large array → push(...b) is very fast you're adding many elements to a large array → concat is slightly faster than a loop you're adding many elements to a small array → concat is much faster than a loop you're usually adding only a few elements to any size array → loops are about as fast as the limited methods for small additions, but will never throw an except..