Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Coin toss with JavaScript and HTML

var prob1 = Math.floor(Math.random() * 2) +1;

var prob2 = Math.floor(Math.random() * 2) +1;

if( prob1 === prob2){
   document.write('You Got TAIL');
 }else{
   document.write('You Got HEAD');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Coin #toss #JavaScript #HTML
ADD COMMENT
Topic
Name
8+2 =