Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

grid square random number

1. 
const createSquares = (numberOfSquares) => {
    for (let i = 0; i < 12; i++){
        const square = $('box')
        $('.squares').append(square)
    }
  }
$('.startgame').on('click',() => {
    createSquares();
})




let randObj = {

};
for(let i = 0; i < 12; i++){
    randObj[i] = randomNumber(0, 11)
    
}


function randomNumber(min, max) { 
    return Math.floor(Math.random() * (max - min) * 1);
} 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #grid #square #random #number
ADD COMMENT
Topic
Name
8+9 =