I have an array of strings and require just 4 of these (randomly) to be placed into another array.
var a = ["Orange", "Red", "Yellow", "Blue", "Black", "White", "Brown", "Green"];
var b = [];
function selectColours(){
var toRandomise = a[Math.floor(Math.random() * 4)];
b.push(toRandomise);
}
console.log(b);
My problem is that the Console shows nothing appearing.
selectColours()?a[Math.floor(Math.random() * 4)]witha[Math.floor(Math.random() * a.length)]