code: function multiplyByNumber(num, x, base) {
    if (num < 0) return null;
    if (num == 0) return [];
    var result = [];
    var power = x;
  
    while (true) {
      if (num & 1) {
        result = add(result, power, base);
      }
  
      num = num >> 1;
      if (num === 0) break;
      power = add(power, power, base);
    }
  
    return result;
  }
docs: Returns a*x, where x is an array of decimal digits and a is an ordinary JavaScript number. base is the number base of the array x.