code: function removeTrailingZeros(str) {
    if (typeof str != 'string') throw new Error('in removeTrailingZeros, data type mismatch');
  
    let iNonZero = -1;
    for (let i = str.length - 1; i >= 0; i--) {
      if (charToVal(str[i]) != 0) {
        iNonZero = i; // index of the first nonzero digit from the right.
        break;
      }
    }
    str = str.slice(0, iNonZero + 1); // if 'str' is entirely zeros or is the empty string, gives ''.
  
    return str;
  }
docs: /* Remove the trailing zeros from a string.
  *