Adding items to an object through the .push() method

后端 未结 5 421
Happy的楠姐
Happy的楠姐 2020-12-04 08:15

I\'m doing a loop through few input elements of \'checkbox\' type. After that, I\'m adding values and checked attributes to an array. This is my code:

var st         


        
5条回答
  •  暖寄归人
    2020-12-04 08:55

    This is really easy: Example

    //my object
    var sendData = {field1:value1, field2:value2};
    
    //add element
    sendData['field3'] = value3;
    

提交回复
热议问题