Learning Goals
1. How to master the Math object:
Min()
Max()
Ceil()
Floor()
Round()
ABS()
Math.min ()
Grammar:
Math.min (num1,num2,... numn)
Function:
Find the minimum value in a set of numbers.
return Value: Number.
Math.max ()
Grammar:
Math.max (num1,num2,... numn)
Function:
Find the maximum value in a set of numbers.
return Value: Number.
Math.ceil ()
Grammar:
Math.ceil (num)
Function:
Rounding up, which returns the smallest integer greater than Num.
return Value: Number.
Math.floor ()
Grammar:
Math.floor (num)
Function:
takes an integer down and returns the integer portion of Num.
return Value: Number.
Math.Round ()
Grammar:
Math.Round (num)
Function:
Rounds an integer to the nearest integer.
return Value: Number.
Math.Abs ()
Grammar:
Math.Abs (num)
Function:
returns num is the absolute value.
return Value: Number
Learning Goals
1. grasp the random () method of the Math object
2. encapsulates a function that evaluates to a random integer between N and M.
Learning Goals
1. grasp the random () method of the Math object
2. encapsulates a function that evaluates to a random integer between N and M.
Math.random ()
Grammar:
Math.random ()
features :
Returns a random number greater than or equal to 0 less than 1 .
return Value: Number.
Description
The formula for finding a random integer between N and m :
Random=math.floor (Math.random () * (m-n+1) +n);
Built-in objects in JavaScript -8-math-3