第一:math.round就是四舍五入,
第二:Math.random()可以产生出0-1之间的任意小数。
Math.round();
Math.ceil();
Math.floor();
这几个函数都是用来取得整数的,Math.round();是采用四舍五入方式取得最接近的整数。Math.ceil();是向上取得一个最接近的整数。Math.floor(); 和Math.ceil();相反,Math.floor();向下取得一个最接近的整数。
第二:Math.random()可以产生出0-1之间的任意小数。
Math.round();
Math.ceil();
Math.floor();
这几个函数都是用来取得整数的,Math.round();是采用四舍五入方式取得最接近的整数。Math.ceil();是向上取得一个最接近的整数。Math.floor(); 和Math.ceil();相反,Math.floor();向下取得一个最接近的整数。