How to get the sum of array elements RRS feed

  • Question

  • Hi all,


    i was trying to get the sum of array values retrieved by a xml query, so i have used the following code:


    var doc = new ActiveXObject("MSXML2.DOMDocument");

    doc.async = false;


    var m = doc.selectNodes("//q1:manualdiscountamount");

    var totalLineItemDiscountAmount=0;









    alert("the sum is:"+totalLineItemDiscountAmount);


    but for some reason that i cannot understand, this code concatenate the elements !!!


    could anybody please help me to modify THIS code so i can get the summation of array values


    any help will be appreciated


    thanks in advance

    Monday, November 15, 2010 10:50 PM


All replies