Problems with ARRAY and FUNCTION in JAVASCRIPT

0

Hello, I come to you to see if they give me a hand because I have the following error in javascript:

TAXESID[1] = 1;
TAXESNAME[1] = "Ninguno";
TAXESISONAME[1] = "Ninguno";
TAXESPORCENT[1] = "0.00";

TAXESID[2] = 2;
TAXESNAME[2] = "Impuesto General a la Venta";
TAXESISONAME[2] = "IGV";
TAXESPORCENT[2] = "18.00";

TAXESID[3] = 3;
TAXESNAME[3] = "Exonerado";
TAXESISONAME[3] = "Exonerado";
TAXESPORCENT[3] = "0.00";


function sumar(fila) {
    cantidad = document.getElementById('cantidad[' + fila + ']').value;
    preciounitario = document.getElementById('preciounitario[' + fila + ']').value;
    impuestoid = document.getElementById('impuesto[' + fila + ']').value;
    totalsindescuento = (cantidad * preciounitario);
    preciototal = totalsindescuento;
    preciototal = preciototal.toFixed(2);
    document.getElementById('preciototal[' + fila + ']').value = preciototal;
    descuento.toFixed(2);


    if (impuestoid == 2) {

        pvcigv = preciototal * (1 + (TAXESPORCENT[impuestoid] / 100));
        alert(pvcigv);
    }



}
sumar(1);

The problem is to pull the array inside the function so that the taxes work, TAXESPORCENT[impuestoid] where impuestoid is already given a value in an input text.

    
asked by Christian Cabrera 21.10.2017 в 19:16
source

0 answers