如何使用Math对象按数组的长度进行缩放

How would I use Math objects to scale by the length of an array?

本文关键字:缩放 数组 何使用 Math 对象      更新时间:2023-09-26

我想是Math.floor(Math.random() * .length),我不知道我应该在.length之前放什么

var example0 = new array("example", "example2");

我要写Math.floor(Math.random() * example0.length吗?

var example0 = new Array("example", "example2");
alert(Math.floor(Math.random() * example0.length));

在问之前,试着自己做,检查你的开发控制台,捕捉错误,日志。有很多信息(在您的开发人员控制台)。我们都是人,有时会感到无聊,疲惫,因此我们都会犯错误或只是拼写错误。