So I want the elements from the students variable to be pushed into the results array in a randomised order each time the code is ran.
I'm not sure how to do this as I am pretty new to JavaScript.
Here's my code.
function getRandomElement(arr){
return arr[Math.floor((Math.random()* arr.length))];
}
var students = ['John', 'Dan', 'Jordan', 'Matt', 'Beth'];
var results = [];
for(var ) {
results.push (getRandomElement(students));
}
//console.log(getRandomElement(students));
console.log(results);