freeCodeCamp Challenge Guide: Create a JavaScript Slot Machine

freeCodeCamp Challenge Guide: Create a JavaScript Slot Machine
0

#1

For this we have to generate three random numbers using the formula they give us and not the general one. Math.floor(Math.random() * (3 - 1 + 1)) + 1;

slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;

#2

@Rafase282 Yes, I also thought about this but it’s not enough to pass all 4 checks. It allows to pass the first 3 checks but not the last, why?


#3
  function _random(a,b){
 return Math.floor(Math.random()*(b - a +1)+a);

}
slotOne = _random(1,3);
slotTwo = _random(1,3);
slotThree = _random(1,3);
// Only change code above this line.


#4