Randomly group elements of array using Javascript

I have json file, from which I display the data:

data: [
{
name: "john"
},
{
name: "lora"
},
...
]

in total i have 16 names. what i want to do is to randomly group this array by 4 people, total 4 groups.
what is the best way to do this using react.js?

37 thoughts on “Randomly group elements of array using Javascript”

Leave a Comment