Push Overrides object in Array JS

Viewed 14

I have problem with JS push function . When i filling object and pushing it to array it replace existing element . Not pushing every object .

Code :

        const requestArray = [];
    var requestModelFo = {
        FOL_DGR: $scope.radioYesDgr,
        FOL_OOG: $scope.radioYesOog,
        FOL_PRODUCTCODE: $scope.productCode,
        FOL_ARTICLE: $scope.article,
        FOL_DESC: $scope.description,
        FOL_HSCODE: $scope.hsCode,
        FOL_ORIGN: Number($scope.countryOrigin),
        FOL_UOM: Number($scope.selectUom),
        FOL_Qty: $scope.qty,
        FOL_UNITPRICE: $scope.unitPrice,
        FOL_UNITTOTAL: $scope.totalPrice,
        FOL_UNITENDTOTAL: Number($scope.currency),
        FOL_UNITWEIGHT: $scope.unitWeight,
        FOL_UNITTOTALWEIGHT: $scope.totalWeight,
    };
    requestArray.push({requestModelFo});
    console.log(requestArray);

I can't get where is the problem .

0 Answers
Related