javascript實現(xiàn)整除的實現(xiàn)代碼,需要的朋友可以參考下。復制代碼 代碼如下://整除 function Div(exp1, exp2) { var n1 = Math.round(exp1); //四舍五入 var n2 = Math.round(exp2); //四舍五入 var rslt = n1 / n2; //除 if (rslt >= 0) { rslt = Math.floor(rslt); //返回值為小于等于其數(shù)值參數(shù)的最大整數(shù)值。 } else { rslt = Math.ceil(rslt); //返回值為大于等于其數(shù)字參數(shù)的最小整數(shù)。 } return rslt; }