The problem with your code is you’re aren’t calling Math.random
.
console.log(Math.round(Math.random()) ? "YES": "NO")
Alternatively, you can check if Math.random()
is greater than 0.5
or not.
console.log(Math.random() > 0.5 ? "YES": "NO")
2
solved How do I create a code that will log either YES or NO. can somebody make this for me? (Javascript) [closed]