JavaScript Math.round() 方法
Math.round()方法的定义和用法:
Math.round()方法将对参数进行四舍五入操作。
点击可参阅更多相关Math对象方法和属性。
语法结构:
Math.round(x)
参数列表:
实例代码:
实例一:
console.log(Math.round(-2.1));
输出结果:-2。
实例二:
console.log(Math.round(-2.9));
输出结果:-3。
实例三:
console.log(Math.round(2.9));
输出结果:3。
以上内容是小编给大家介绍的JavaScriptMath.round()方法的全部叙述,希望大家喜欢。
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语