向下取整floor()
任务
补充右边编辑器在script标签内,使用floor()方法,计算3.3、-0.1、-9.9、8.9值。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math </title>
<script type="text/javascript">
document.write(Math.floor(3.3)+"<br/>");
document.write(Math.floor(-0.1)+"<br/>");
document.write(Math.floor(-9.9)+"<br/>");
document.write(Math.floor(8.9));
</script>
</head>
<body>
</body>
</html>
本文详细介绍了JavaScript中向下取整方法floor()的用法,包括其语法、参数及返回值特点,并通过实例展示了如何对不同数值进行向下取整操作。

216

被折叠的 条评论
为什么被折叠?



