enter image description herewhat I want is to create an array with random numbers so I can then add them to another array with a foreach
let jsonlength = this.accesoriosJson.length
let a = 0;
let randomNumber = new Array()
var myInterval = setInterval(function(){
a++
if (a > jsonlength) {
clearInterval(myInterval);
}else{
randomNumber.push(Math.ceil(Math.random()*10))
}
},100)
console.log(randomNumber)
randomNumber.forEach(valor => {console.log(valor)})
I don't understand why the foreach doesn't work because console.log(randomNumber) works just fine
console.log(randomNumber)works fine?