Created
October 3, 2021 09:40
-
-
Save sayyedhammadali/b8620d27813aca0ad46ede2f08a1dbd2 to your computer and use it in GitHub Desktop.
Get a random boolean (true/false)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const randomBoolean = () => Math.random() >= 0.5; | |
console.log(randomBoolean()); | |
// Result: a 50/50 change on returning true of false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment