簡體   English   中英

如何將 append object 變成空數組

[英]how to append the object into empty array

這是我的代碼。 我在控制台中編寫了代碼


預期的output如下:

var myArray = [{
    fruit: 'apple',
    price: '90',
    qty: '6'
  },
  {
    fruit: 'mango',
    price: '100',
    qty: '6'
  },
  {
    fruit: 'pineapple',
    price: '50',
    qty: '1'
  }
];

這樣的例子:

 myArray .push({ fruit: 'apple', price: '90', qty: '6' })

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM