Javascript Object push() function

后端 未结 7 2130
借酒劲吻你
借酒劲吻你 2020-11-28 02:35

I have a javascript object (I actually get the data through an ajax request):

var data = {};

I have added some stuff into it:



        
7条回答
  •  渐次进展
    2020-11-28 03:28

        tempData.push( data[index] );
    

    I agree with the correct answer above, but.... your still not giving the index value for the data that you want to add to tempData. Without the [index] value the whole array will be added.

提交回复
热议问题