-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
18 lines (13 loc) · 700 Bytes
/
script.js
File metadata and controls
18 lines (13 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const generateBtn = document.querySelector(".generateBtn");
generateBtn.addEventListener("click", generateRandomNum);
function generateRandomNum() {
const fromNum = document.querySelector(".fromNum").value;
const toNum = document.querySelector(".toNum").value;
randomNum = Math.floor(Math.random() * parseInt(toNum));
if(randomNum==7) randomNum = 8; /* Put here your number to exclude in brackets and number to trasform in*/
if(randomNum==3) randomNum = 4; /* Put here your number to exclude in brackets and number to trasform in*/
if (randomNum >= parseInt(fromNum)) {
const randomNumEl = document.querySelector(".randomNumEl");
randomNumEl.innerHTML = randomNum;
}
}