Horje
get random entry from array javascript Code Example
javascript get random array value
//get random value from array
var colors = ["red","blue","green","yellow"];
var randColor = colors[Math.floor(Math.random() * colors.length)];
how to get a random element of an array javascript
var foodItems = ["Bannana", "Apple", "Orange"];
var theFood = foodItems[Math.floor(Math.random() * foodItems.length)];
/* Will pick a random number from the length of the array and will go to the
corosponding number in the array E.G: 0 = Bannana */
get random entry from array javascript
const rnd = (arr) => { return arr[Math.floor(Math.random() * arr.length)] };




Javascript

Related
datatable desc active Code Example datatable desc active Code Example
js refresh element Code Example js refresh element Code Example
how to can i get custom data attribute value in javascript Code Example how to can i get custom data attribute value in javascript Code Example
regex for lowercase letters js Code Example regex for lowercase letters js Code Example
call function on modal open Code Example call function on modal open Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7