Random Number Generator

const maxNumber = 10;
const arrayNumber = ;
for (let i=0; i<10;i++){
const randomNumber = Math.floor((Math.random() * maxNumber) + 1);
arrayNumber.push ( randomNumber )
}
console.log(arrayNumber)

When I console log arrayNumber it shows some repeated numbers e.g. ,

I want to add unique numbers. How can I do this, please advise.

you can do this by checking that , if arrayNumber not contain random number then include it to arrayNumber i.e.

if(arrayNumber.indexOf(randomNumber)==-1){
	arrayNumber.push ( randomNumber )
}

Thanks a lot @FatmaNagori it solved my problem. :slightly_smiling_face: