var multiply = function(num1, num2){
var l1=num1.length;
var l2=num2.length;
if(l1==0||l2==0){
return "";
}
var rel=new Array();
for(var i=0;i<l1+l2;i++){ // rel 是存储的字符串数组
rel.push(0);
}
for(var j=l1-1;j>=0;j--){
var add=0;
for(var k=l2-1;k>=0;k--){ // -'0'隐式转为数值
var mul=(num1[j]-'0')*(num2[k]-'0');
var sum=rel[j+k+1]+mul%10-'0'+add;
rel[j+k+1]=sum%10;
add=parseInt(mul/10)+parseInt(sum/10);
}
rel[j]+=add;
}
for(var p=0;p<l1+l2;p++){
if(rel[p]!=0)
return rel.slice(p).join("");
}
return "0";
};
// console.log(multiply("123","456"));