2

少し奇妙なエラーが表示されます。

配列のインデックスをランダムに選択しようとしているので、これを行うために以下のコードを使用しています。

myArray[Math.floor(Math.random*myArray.length)]

myArray.length は 282 ですが、Math.floor(Math.random*myArray.length)NaN でmyArray[Math.floor(Math.random*myArray.length)未定義です。

何かご意見は?

4

2 に答える 2