function multiply(a, b) {
let strA = a.toString();
let strB = b.toString();
let lenA = strA.includes('.') ? strA.split('.')[2].length : 0;
let lenB = strB.includes('.') ? strB.split('.')[1].length : 0;
return (a * b).toFixed(lenA + lenB);
}
// 测试用例
console.log(multiply(3, 0.1));