获得绝对价值: Math.abs()
document.write(Math.abs(7.25)); // 7.25
document.write(Math.abs(-7.25)); // 7.25
document.write(Math.abs(null)); // 0
document.write(Math.abs("Hello")); // NaN
document.write(Math.abs(7.25-10)); // 2.75
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4710 次 |
| 最近记录: |