JavaScript中的Math.abs()函数
Math对象的abs()函数接受一个数字并返回其绝对值。
语法
其语法如下
Math.abs(3)
示例
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.abs(3);
document.write("Absolute value: "+result);
</script>
</body>
</html>输出结果
Absolute value: 3
热门推荐
10 写给兄弟的祝福语简短
11 分手快乐祝福语简短
12 经典祝福语简短情侣句子
13 中秋祝福语简短版大全
14 新年的生日祝福语简短
15 发给女儿生日简短祝福语
16 剪简短的新年祝福语
17 良师益友祝福语简短
18 迎新祝福语简短20字