how to Write a program that simulates a coin toss using random method of Javascript Math class
var head = 1;
var tail = 2;
var toss = Math.random() * 2;
var floor = Math.floor(toss)
if(floor === 0){
document.write("0 <br> Random Coin Value: Head")
} else if(floor === 1)
{
document.write("1 <br> Random Coin Value: Tails")
}
Also in JavaScript:
- how to check if browser is firefox in javascript
- update table remove a key from json object mysql
- react create array
- how to replace first and last character of string in javascript
- currentTime(); javascript
- jquery if checkbox is checked
- node js colors
- loopback not null
- component unmount useeffect
- http-proxy-middleware option.onProxyReq:
- angular cdk media query
- how to add thumbnail image carousel in javascript fancybox
- html get selected option javascript
- javascript sort array by object property
- jstree get data
- moment js print date
- js string have number js
- Ajax send date to MVC
- angular cli skip-tests
- javascript appendchild at index
- how to change background image dynamically in react
- nodejs cluster example
- difference between == and === in javascript
- sequelize where more than