Array.prototype.random = function() { return this[Math.floor(Math.random() * this.length)] ; } ; var arr = [1, 2, 3] ; alert(arr.random()) ;