var texts = new Array("text1", "text2", "text2", "text3", "text4", "text5")
var textNumber = Math.floor(Math.random() * 10) + 1;
$('#textArea').html('<p>{texts[textNumber]}<p>');
I have this code, and i want this script to randomly choose an element of ‘texts’ array, and put it where the ‘#textArea’ is, but interpolation doesn’t seem to work, what is wrong here?
Just a better code to do what you seen you are trying to do…