I am struggling to create a JavaScript code that can select a random string of text from an array. I have attempted the following code, but it doesn't seem to work. Any assistance would be greatly appreciated. Just to clarify, this is intended for a website.
var myArray = ['Embrace your inner acorn', 'Find joy in the whispering of the acorns', 'Acorns are nature's way of saying hello','It takes time to become an acorn'];
var rand = myArray[Math.floor(Math.random() * myArray.length)];
var postmessage = +myArray;