let arr = [];
while (arr.length < 5) {
  let rand = Math.ceil(Math.random() * 10);
  arr.indexOf(rand) == -1 && arr.push(rand);
}
console.log(arr);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.