Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the functions of javascript

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly talks about "what are the functions of javascript". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the functions of javascript"?

This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.

What are the javascript functions?

JavaScript built-in functions (built-in functions, built-in keywords)

The built-in object of js is included with js, which encapsulates some commonly used methods. Commonly used js built-in objects are: String,Date,Array,Math, etc.

Js built-in functions are built into the browser kernel and can be used directly without any library introduction. Javascript 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, and 6 represents 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 is January, 2 is March, and 11 is 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, and 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.

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.

At this point, I believe you have a deeper understanding of "what are the functions of javascript?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report