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