javascript how to get a random element from an array
snippet in javascript

javascript how to get a random element from an array

user6811

var items = ['Yes', 'No', 'Maybe'];
var item = items[Math.floor(Math.random() * items.length)];