Returns a random element from the given array - Node.js Array

Node.js examples for Array:Random Array

Description

Returns a random element from the given array

Demo Code

randomElement = function (array) {
  return array[ random(0, array.length - 1) ];
}

Related Tutorials