我想要一個JavaScript代碼從數組中隨機選擇一個文本字符串。這是我迄今爲止的,但它似乎並沒有工作,感謝幫助。不知道這是否重要,但這是一個網站。隨機數組中的文本字符串
var myArray = ['One does not simply click the acorn'.'acorn spices all the rage with Martha Stewart', 'Once more into the acorn tree my friends','Acornbook launches as first acorn based social media'];
var rand = myArray[Math.floor(Math.random() * myArray.length)];
var postmessage = + myArray;
具體什麼不工作?你做了什麼來調試它? – clearlight 2015-03-31 02:19:25
@ntalbs - 太好了,您實際上是通過編輯修改了代碼。 – 2015-03-31 02:19:37