JavaScript数组未定义元素

这个问题在这里已经有了答案:

  • 如何在JavaScript中的数组的开头添加新的数组元素? 6个答案

  • this.arraylist is wrong this represent a current object you are not currently using any class in above code you just need to change 
    
      function putToFirst(e){
       var array = [];
       var arrayList=[];
       array.push(e);
      arrayList = array.concat(arrayList);
      console.log(arrayList);
    }
    
    链接地址: http://www.djcxy.com/p/19357.html

    上一篇: JavaScript Array undefined element

    下一篇: Pushing an object to beginning of an array