Passing an array as parameter in JavaScript

后端 未结 3 1213
既然无缘
既然无缘 2020-12-28 15:06

I have an array, and I want to pass it as a parameter in a function such as:

function something(arrayP){
    for(var i = 0; i < arrayP.length; i++){
              


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 15:34

    It is possible to pass arrays to functions, and there are no special requirements for dealing with them. Are you sure that the array you are passing to to your function actually has an element at [0]?

提交回复
热议问题