Home  >  Article  >  Web Front-end  >  What are the internal methods of JavaScript?

What are the internal methods of JavaScript?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-22 11:23:002593browse

js built-in functions are functions that come with the browser kernel and can be used directly without introducing any function library. JavaScript built-in functions can be divided into five categories: 1. Regular functions; 2. Array functions; 3. Date functions; 4. Mathematical functions; 5. String functions.

What are the internal methods of JavaScript?

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

js built-in functions are functions that come with the browser kernel and can be used directly without introducing any function library. JavaScript built-in functions can be divided into five categories:

1, regular function

2, array function

3, date function

4, mathematical function

5. String functions

The first category: regular functions

includes the following 9 functions:

(1)alert function: displays a warning Dialog box, including an OK button.

(2)confirm function: Display a confirmation dialog box, including OK and Cancel buttons.

(3)escape function: Convert characters into Unicode codes.

(4)eval function: calculates the result of an expression.

(5)isNaN function: Test whether (true) or not (false) is not a number.

(6)parseFloat function: Convert a string into dotted digital form.

(7)parseInt function: Convert the string into integer digital form (the decimal system can be specified).

(8)prompt function: Display an input dialog box, prompting to wait for user input.

Second Category: Array Function

Includes the following 4 functions:

(1)Join function: Convert and connect all elements in the array into a string.

(2)langth function: Returns the length of the array.

(3)reverse function: Reverse the order of array elements.

(4)sort function: Reorder array elements.

The third category: date function

Includes the following 20 functions:

(1)getDate function: returns the "day" part of the date, with values ​​from 1 to 31

(2)getDay function: Returns the day of the week, the value is 0~6, where 0 means Sunday, 1 means Monday,..., 6 means Saturday

(3)getHours function: Returns the "hour" part of the date, with values ​​ranging from 0 to 23.

(4)getMinutes function: Returns the "minutes" part of the date, the value is 0~59. See the example above.

(5)getMonth function: Returns the "month" part of the date, the value is 0~11. Among them, 0 represents January, 2 represents March, ..., and 11 represents December. See previous example.

(6)getSeconds function: Returns the "seconds" part of the date, the value is 0~59. See previous example.

(7)getTime function: Returns the system time.

(8)getTimezoneOffset function: Returns the time difference in this region (the regional time difference between local time and GMT Greenwich Mean Time), in minutes.

(9)getYear function: Returns the "year" part of the date. The return value is based on 1900, for example, 1999 is 99.

(10)parse function: Returns the number of milliseconds since 0:00 on January 1, 1970 (local time).

(11)setDate function: Set the "day" part of the date, the value is 0~31.

(12)setHours function: Set the "hour" part of the date, the value is 0~23.

(13)setMinutes function: Set the "minutes" part of the date, the value is 0~59.

(14)setMonth function: Set the "month" part of the date, the value is 0~11. Among them, 0 represents January, ..., and 11 represents December.

(15)setSeconds function: Set the "seconds" part of the date, the value is 0~59.

(16)setTime function: set time. The time value is the number of milliseconds since 00:00 on January 1, 1970.

(17)setYear function: Set the "year" part of the date.

(18)toGMTString function: Convert the date into a string, which is GMT Greenwich Mean Time.

(19)setLocaleString function: Convert date into string and local time.

(20) UTC function: Returns the number of milliseconds since 0:00 on January 1, 1970, calculated in GMT Greenwich Mean Time.

Fourth Category: Mathematical Functions

There are 18 functions as follows:

(1)abs function: Math.abs (the same below), returns the absolute value of a number value.

(2) acos function: Returns the inverse cosine value of a number, and the result is 0 to π radians (radians).

(3)asin function: Returns the arcsine value of a number, and the result is -π/2~π/2 radians.

(4)atan function: Returns the arctangent value of a number, and the result is -π/2~π/2 radians.

(5)atan2 function: Returns the polar coordinate angle value of a coordinate.

(6)ceil function: Returns the smallest integer value of a number (greater than or equal to).

(7)cos function: Returns the cosine value of a number, and the result is -1~1.

(8)exp function: Returns the power value of e (natural logarithm).

(9)floor function: Returns the maximum integer value of a number (less than or equal to).

(10)log function: natural logarithm function, returns the natural logarithm (e) value of a number.

(11)max function: Returns the maximum value of two numbers.

(12)min function: Returns the minimum value of two numbers.

(13)pow function: Returns the power of a number.

(14)random function: Returns a random value between 0 and 1.

(15)round function: Returns the rounded value of a number, the type is integer.

(16) sin function: returns the sine value of a number, and the result is -1~1.

(17)sqrt function: Returns the square root value of a number.

(18)tan function: Returns the tangent value of a number.

Fifth Category: String Function

Includes the following 20 functions:

(1)anchor function: generates a link point (anchor) for use as a hyperlink. The anchor function sets the name of the link point of , and the other function link sets the URL address of .

(2)big function: Increase the font to size one, which is the same as the ... tag.

(3)blink function: Makes the string blink, which is the same as the ... tag result.

(4)bold function: Make the font bold, which is the same as the ... tag result.

(5)charAt function: Returns a character specified in the string.

(6)fixed function: Set the font to a fixed-width font, which is the same as the ... tag.

(7)fontcolor function: Set the font color, which is the same as the tag result.

(8)fontsize function: Set the font size, which is the same as the tag result.

(9)indexOf function: Returns the first index found in the string, starting from the left.

(10) italics function: Make the font italic, which is the same as the ... tag result.

(11)lastIndexOf function: Returns the first subscript index found in the string, starting from the right.

(12)length function: Returns the length of the string. (Without parentheses)

(13) link function: Generate a hyperlink, which is equivalent to setting the URL address of .

(14)small function: Reduce the font size by one size, which is the same as the ... tag.

(15)strike function: Add a horizontal line in the middle of the text, which is the same as the ... tag.

(16)sub function: Display the string as a subscript.

(17)substring function: Returns several characters specified in the string.

(18)sup function: Display the string as superscript.

(19)toLowerCase function: Convert the string to lowercase.

(20)toUpperCase function: Convert the string to uppercase.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What are the internal methods of JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn