To create a 50/50 chance in JavaScript, you can use the `Math.random`

function, which returns a random number between 0 and 1.

Here’s an example of how you can create a 50/50 chance in JavaScript:

```
let chance = Math.random();
if (chance < 0.5) {
console.log("You got heads!");
} else {
console.log("You got tails!");
}
```

This code will randomly generate a number between 0 and 1, and if the number is less than 0.5, it will output “You got heads!”, and if the number is greater than or equal to 0.5, it will output “You got tails!”. This simulates a 50/50 chance.

## + There are no comments

Add yours