Is there a reason JavaScript developers don't use Array.push()?

前端 未结 6 1168
庸人自扰
庸人自扰 2020-12-01 05:29

I commonly see developers use an expression like the following in JavaScript:

arr = []
arr[arr.length] = \"Something\"
arr[arr.length] = \"Another thing\"
         


        
6条回答
  •  北海茫月
    2020-12-01 05:57

    I think its not about performance, or at least is not such a big deal... what really matters here is declarative way vs imperative way.

提交回复
热议问题