Answers for "select 4 random items from an array"

8

pick a random element from an array javascript

var myArray = [
  "Apples",
  "Bananas",
  "Pears"
];

var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
Posted by: Guest on April-19-2020
1

js random string from array

const randomElement = array[Math.floor(Math.random() * array.length)];
Posted by: Guest on April-07-2020

Code answers related to "select 4 random items from an array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language