1var groceries = [
2'milk',
3'coriander',
4'cucumber',
5'eggplant'
6]
7let mygroceries = groceries[Math.floor(Math.random() * groceries.length)]
8console.log(mygroceries)//This gives you any string from groceries
9
10
1pick random string from array javascriptJavascript By Joyous Jackal on Jun 14 2020
2var groceries = [
3'milk',
4'coriander',
5'cucumber',
6'eggplant'
7]
8let mygroceries = groceries[Math.floor(Math.random() * groceries.length)]
9console.log(mygroceries)//This gives you any string from groceries