|
|
@@ -0,0 +1,27 @@
|
|
|
+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)) // 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 randomNum = Math.ceil(Math.random()* (4 + 1))
|
|
|
+ console.log(randomNum)
|
|
|
+ return guess === randomNum
|
|
|
+}
|
|
|
+
|
|
|
+console.log(makeGuess(1))
|