Lea*_*Luk 0 javascript math
我是stackoverflow的新手,请你忍受我.我需要在JavaScript中进行数学计算,它总是会返回两个变量之间的差异.在数学中看起来像这样:
a = 10; b = 5; a-b = 5; b-a = -5; |a-b| = 5; /*need this*/ |b-a| = 5; /*need this*/
怎么办?
tec*_*bar 5
使用Math.abs()得到绝对值.
Math.abs()
Math.abs(4-5) => 1
Math.abs(4-5)
1
归档时间:
12 年 前
查看次数:
80 次
最近记录: