2020年12月22日星期二

Add or Push new item to array

How can I add another entry to an array?

Here's my code

function addItem(){    var reimbursementArr = [];      reimbursementArr.push({     txnDate: document.getElementById("txnDate").value,     summaryOfExpense: document.getElementById("summaryOfExpense").value,     project: document.getElementById("project").value,     referenceNumber: document.getElementById("referenceNumber").value,     address1: document.getElementById("address1").value,     address2: document.getElementById("address2").value,     city: document.getElementById('city').value,     country: document.getElementById('country').value,     serviceCharge: document.getElementById('serviceCharge').value,     valueAddedTax: document.getElementById('valueAddedTax').value,     currency: document.getElementById('currency').value,     amountWithoutVAT: document.getElementById('amountWithoutVAT').value,     expandedWitholdingTax: document.getElementById('expandedWitholdingTax').value,     }); //put to the array  
https://stackoverflow.com/questions/65418162/add-or-push-new-item-to-array December 23, 2020 at 10:06AM

没有评论:

发表评论