Skip to content

RalucaElisabetaR/dice-chalange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math.random method is not “random enough” for serious things like cryptograph or anything related to security, but is fair enough to be used in this case.
Fun little challange for those of you who wants to practice the basics of the Document Object Model. 💻 👯
let randomNumber1 = Math.floor(Math.random() * 6) + 1;
let randomDicePhoto = "images/dice" + randomNumber1 + ".png";
document.querySelectorAll("img")[0].setAttribute("src", randomDicePhoto);

let randomNumber2 = Math.floor(Math.random() * 6) +1;
let randomDicePhoto2 = "images/dice" + randomNumber2 + ".png";
document.querySelectorAll("img")[1].setAttribute("src", randomDicePhoto2);
function refresh(){
window.location.reload("Refresh");
}

About

Dice Challenge using the JavaScript Math Object.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published