What are the categories of javascript built-in functions?
This article mainly introduces the javascript built-in functions are divided into which categories of related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will gain after reading this javascript built-in functions into which categories of articles, let's take a look at it.
In javascript, built-in functions are functions that come with the browser kernel and can be used directly without the introduction of any library. Common built-in functions can be divided into five categories: 1, regular functions; 2, array functions; 3, date functions; 4, mathematical functions; 5, string functions.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Built-in functions in javascript
Js built-in functions are built into the browser kernel and can be used directly without any library introduction.
Common built-in functions can be divided into five categories:
1. General function
2. Array function
3. Date function
4. Mathematical function
5. String function
The first category: regular functions
Includes the following nine functions:
(1) alert function: displays a warning dialog box, including an OK button.
(2) confirm function: displays a confirmation dialog box, including OK and Cancel buttons.
(3) escape function: converts characters into Unicode codes.
(4) eval function: the result of evaluating the expression.
(5) isNaN function: test whether (true) or (false) is not a number.
(6) parseFloat function: converts a string into a symbol point number.
(7) parseInt function: converts the string to integer numeric form (decimal can be specified).
(8) prompt function: displays an input dialog box that prompts you to wait for user input.
The second category: array functions
Includes the following four functions:
(1) join function: converts and concatenates all elements in the array into a string.
(2) langth function: returns the length of the array.
(3) reverse function: reverses 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 a value of 1-31
(2) getDay function: returns the day of the week, with a value of 0,6, where 0 represents Sunday, 1 represents Monday, … , 6 means Saturday
(3) getHours function: returns the "hour" part of the date, with a value of 0023.
(4) getMinutes function: returns the "minute" part of the date, with a value of 0059. See the above example.
(5) getMonth function: returns the "month" part of the date, with a value of 011. Where 0 means January, 2 means March, … , 11 means December. See the previous example.
(6) getSeconds function: returns the "second" part of the date, with a value of 0059. See the previous example.
(7) getTime function: returns the system time.
(8) getTimezoneOffset function: returns the time difference of this area (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, 99 in 1999.
(10) parse function: returns the number of milliseconds (local time) from 00:00 on January 1st, 1970.
(11) setDate function: sets the "day" part of the date, with a value of 0,31.
(12) setHours function: sets the "hour" part of the date, with a value of 0,23.
(13) setMinutes function: set the "minutes" part of the date, with a value of 0059.
(14) setMonth function: sets the "month" part of the date, with a value of 011. Where 0 means January, … , 11 means December.
(15) setSeconds function: sets the "second" part of the date, with a value of 0059.
(16) setTime function: set the time. The time value is the number of milliseconds from 00:00 on January 1, 1970.
(17) setYear function: the "year" part of the set date.
(18) toGMTString function: converts the date into a string, which is GMT Greenwich mean time.
(19) setLocaleString function: converts the date into a string, local time.
(20) UTC function: returns the number of milliseconds from 00:00 on January 1, 1970, calculated in GMT Greenwich mean time.
Var myDate=new Date (dtime.replace (/-|\. / g, "/"); myDate.getYear (); / / get the current year (2 digits) myDate.getFullYear (); / / get the complete year (4 digits, 1970 myDate.getMonth (); / / get the current month (0-11, 0 represents January) myDate.getDate (); / get the current day (1-31) myDate.getDay () / / get current week X (0-6 myDate.getSeconds represents Sunday) myDate.getTime (); / / get current time (milliseconds since 1970.1.1) myDate.getHours (); / / get current hours (0-23) myDate.getMinutes (); / / get current minutes (0-59) myDate.getSeconds (); / / get current seconds (0-59) myDate.getMilliseconds () / / get the current milliseconds (0,999) myDate.toLocaleDateString (); / / get the current date var mytime=myDate.toLocaleTimeString (); / / get the current time myDate.toLocaleString (); / / get the date and time setTimeout (); setInterval ()
The fourth category: mathematical functions
There are 18 functions:
(1) abs function: that is, Math.abs (the same below), which returns the absolute value of a number.
(2) acos function: returns the inverse cosine of a number, and the result is 0 ~ π radians (radians).
(3) asin function: returns the arcsine of a number, and the result is-π / 2 ~ π / 2 radians.
(4) atan function: returns the inverse tangent of a number, and the result is-π / 2 ~ π / 2 radians.
(5) atan2 function: returns the polar angle value of a coordinate.
(6) ceil function: returns the minimum integer value of a number (greater than or equal to).
(7) cos function: returns the cosine of a number, and the result is-1x 1.
(8) exp function: returns the multiplier value of e (natural logarithm).
(9) floor function: returns the maximum integer value of a number (less than or equal to).
(10) log function: a natural logarithmic function that returns the natural logarithm (e) of a number.
(11) max function: returns the maximum of two numbers.
(12) min function: returns the minimum value of two numbers.
(13) pow function: returns the multiplier value of a number.
(14) random function: returns a random value of 0: 1.
(15) round function: returns the rounded value of a number whose type is an integer.
(16) sin function: returns the sine of a number, and the result is-1 to 1.
(17) sqrt function: returns the square root of a number.
(18) tan function: returns the tangent of a number.
The fifth category: string functions
Includes the following 20 functions:
(1) anchor function: generates a link point (anchor) for hyperlink. The name of the link point set by the anchor function and the URL address set by another function link.
(2) big function: add the font to the first number, and. The label results are the same.
(3) blink function: make the string flicker, and. The label results are the same.
(4) bold function: make the font bold, and. The label results are the same.
(5) charAt function: returns a character specified in the string.
(6) fixed function: set the font to a fixed width font, and. The label results are the same.
(7) fontcolor function: sets the font color, which is the same as the label result.
(8) fontsize function: sets the font size, which is the same as the result of the label.
(9) indexOf function: returns the first subscript index found in the string, starting from the left.
(10) italics function: make the font italic, and. The label results are the same.
(11) lastIndexOf function: returns the first subscript index found in the string, starting on the right.
(12) length function: returns the length of the string. (no parentheses)
(13) link function: generates a hyperlink, which is equivalent to the set URL address.
(14) small function: reduce the font by one number, and. The label results are the same.
(15) strike function: add a horizontal line in the middle of the text, and. The label results are the same.
(16) sub function: displays the string as subscript (subscript).
(17) substring function: returns a few characters specified in the string.
(18) sup function: displays the string as superscript (superscript).
(19) toLowerCase function: converts a string to lowercase.
(20) toUpperCase function: converts a string to uppercase.
This is the end of the article on "what are the categories of javascript built-in functions?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "which types of javascript built-in functions are divided into". If you want to learn more, you are welcome to follow the industry information channel.