Difference between concat and push?

前端 未结 3 1875
萌比男神i
萌比男神i 2020-12-05 00:00

Why does a return of the push method cause \"Uncaught TypeError: acc.push is not a function\". But a return concat results in the correct solution?

3条回答
  •  眼角桃花
    2020-12-05 00:24

    https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki Concat is 945x slower than push only because it has to create a new array.

提交回复
热议问题