Local object
①Array class
②Date class
Type of object Built-in object
①Global object
②Math object
Host object
I will continue to learn objects in JS today. I finished learning local yesterday Two important objects in the object are Array and Date. Today, let’s take a look at the built-in objects Global object and Math object.
Global object
encodeURI() method is used to process the complete URI, removing some spaces and other characters. The
eval() method can calculate a string and execute the JavaScript code in it.
Math object
The min() method and max() method are used to determine the maximum and minimum values in a set of numbers. Both methods accept any number of parameters.
The ceil() method represents the rounding function, which always rounds the number up to the nearest value. The
floor () method represents the rounding down function, which always rounds the number down to the nearest value. The
round() method represents the standard rounding function, which rounds up if the difference between the number and the next integer does not exceed 0.5, otherwise it rounds down. This is a rounding rule learned in junior high school.
The pow() method is used to raise a number to a specified power, such as raising 2 to the 10th power (expressed as 210 in mathematics).
The sqrt() method is used to return the square root of the specified number.
The Math object also has a complete set of trigonometric function methods.
The random() method returns a random number between 0 and 1, excluding 0 and 1. This is a common tool for sites that display random quotes or news on their home page.
Not finished yet. . . random() method example