Decimal in answer


#1

I get a decimal instead of an whole number is that right?


var rock;
var paper; 
var scissors;
var userChoice = prompt (" Please choose rock, paper or scissors");
console.log(userChoice);
var computerChoice = Math.random(0,1);
console.log(computerChoice);


#2

if we check the docs, its says:

Getting a random number between 0 and 1, inclusive

so yea, numbers between 0 and 1 are very likely decimal numbers.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.