
要返回 1 到 200 之间的随机数,请使用 JavaScript Math.random() 和 Math.floor() 方法。
示例
您可以尝试运行下面的代码在 JavaScript 中返回一个随机数。
<!DOCTYPE html>
<html>
<body>
<script>
document.write(Math.floor(Math.random() * 200) + 1);
</script>
</body>
</html>热词: