the full code is in the link I am to trying declare an arrow function by assigning it to the variable randomColor
using the array.push()
method, but I am getting the error "randomColor is not defined" when I run the code. Please help.
function generateRandomColors(num){
let arr = [];
for(let i=0;i < num;i++){
arr.push(randomColor());
}
return arr;
}
let randomColor = () => {
//random for red
let r = Math.floor(Math.random() * 256);
//random for blue
let g = Math.floor(Math.random() * 256);
//random for green
let b = Math.floor(Math.random() * 256);
//return rgb
return "rgb(" + r + ", " + g + ", " + b +")";
};