| 1234567891011121314151617181920212223242526272829 |
- let num = 103.941
- console.log(num.toFixed(2))
- console.log(Math.round(num))
- console.log(Math.floor(num)) //round down to nearest integer
- console.log(Math.ceil(num)) //round up
- //let randomNum = Math.random()
- //console.log(randomNum) // between 0 and 0.999
- // let min = 10
- // let max = 20
- // let randomNum = Math.floor(Math.random() * (max - min + 1)) + min// floor( 10 to 10.999 )
- // //0 to 10
- // console.log(randomNum)
- // Challenge area
- // 1 - 5 - true if correct - false if not correct
- let makeGuess = function (guess) {
- let min = 1
- let max = 5
- let randomNum = Math.floor(Math.random() * (max - min + 1)) + min
- console.log(randomNum)
- return guess === randomNum
- }
- console.log(makeGuess(1))
|