Facebook
From Ivory Butterfly, 5 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 232
  1. const randomSix = function() {
  2.         checkButtonClick = true;
  3.         while(true) {
  4.                 if (result.length === 6) {
  5.                     return;
  6.                 };
  7.                 const div = document.createElement("div"); //Create element
  8.  
  9.                 const score = Math.floor (Math.random() * 49 + 1);
  10.  
  11.                 for (let i = 0; i < result.length; i++) {
  12.                     if (score === result[i]) {
  13.                         score;
  14.                         console.log("taka sama: " + score);
  15.                     }
  16.  
  17.                 div.textContent = score; //Value of the content
  18.                 divArray.push(document.body.appendChild(div)); //Add element
  19.                 result.push(score);
  20.     }
  21. }
  22.