Ad
Mathematics
Algorithms
Logic
Numbers
Fundamentals

You must create a Dice generator.

Dice have 6 sides. Player throws up a cube and look at the result.

Code must have output like this:
function(random){...}

Cube(); // 1
Cube(); // 5
Cube(); // 3
...

You should use Math.floor to get a integer numbers.

function Cube(){
  let random = Math.floor(Math.random()*6+1);
  if(random===1)return 1
  else if(random===2)return 2
  else if(random===3)return 3
  else if(random===4)return 4
  else if(random===5)return 5
  else if(random===6)return 6
}