-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (33 loc) · 984 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function start()
{
// console.log("heee")
var d1= document.getElementById("d1");
var d2 =document.getElementById("d2");
var total = document.getElementById("total");
var status = document.getElementById("status");
//for dice1
var randomnum1= Math.random();
d1=randomnum1;
var improve = ( d1 * 6 ) +1 ;
var flore = Math.floor(improve);
//for dice 2
var randomnum2= Math.random();
d2=randomnum2;
var improve2 = ( d2 * 6 ) +1 ;
var flore2 = Math.floor(improve2);
document.getElementById("d1").textContent = flore;
document.getElementById("d2").textContent = flore2 ;
//total
var total = flore + flore2 ;
document.getElementById("total").textContent = "You rolled " +total;
//status
if(flore!=flore2)
{
status.style.display = "none";
}
else
{
document.getElementById("status").innerHTML = "Double!! u got a new turn";
status.style.display = "block";
}
}