SOURCE

console 命令行工具 X clear

                    
>
console
function getRandomBall() {
  return Math.ceil(Math.random()*36);
}

function doubleBall() {
  const balls = new Array(6);
  balls.map((element, i, arr) => {
    let randomBall = getRandomBall();
    while(isRepeat(arr, randomBall)) {
      randomBall = getRandomBall();
    }
    return randomBall;
  })
  return balls;
}

function isRepeat(array, number) {
  const iNmuber = array.findIndex(element => {
    return element === number;
  });
  if (iNmuber >= 0 ){
    return true; 
  }
  return false;
}

console.log(doubleBall());