var arr = ["a","b","c", "d","e", "f", "g"]; console.log(arr[Math.floor((Math.random()*arr.length))]);
效果图: