code: function round(number, places) {
    if (number[1] && places >= 0 && number[1].length > places) {
      //truncate to correct number of decimal places
      var decim = number[1].slice(0, places);
      //if next digit was >= 5 we need to round up
      if (+(number[1].substr(places, 1)) >= 5) {
        //But first count leading zeros as converting to a number will loose them
        var leadingzeros = "";
        while (decim.charAt(0)==="0") {
          leadingzeros = leadingzeros + "0";
          decim = decim.substr(1);
        }
        //Then we can change decim to a number and add 1 before replacing leading zeros
        decim = (+decim + 1) + '';
        decim = leadingzeros + decim;
        if (decim.length > places) {
          //adding one has made it longer
          number[0] = (+number[0]+ +decim.charAt(0)) + ''; //add value of firstchar to the integer part
          decim = decim.substring(1);   //ignore the 1st char at the beginning which is the carry to the integer part
        }
      }
      number[1] = decim;
    }
    return number;
  }
docs: where number is an array with 0th item as integer string and 1st item as decimal string (no negatives)