Javascript string object date object math object attributes and Methods

Source: Internet
Author: User
Tags natural logarithm
String object

The string object provides many methods for operating the string content.

Attribute

Length: the number of characters in the string.

Method

Big (), blink (), bold (), fixed (), italics (), small (), sub (), strike (), sup (), fontcolor (color), fontsize (size)

The above method adds the corresponding HTML tag for the string.
Charat (INDEX) returns the character at index in the string.
Indexof (searchvalue, [fromindex]) This method searches for the first searchvalue in the string. if fromindex is specified, the search starts from the position in the string. When the searchvalue is found, the position of the first character of the string is returned.
Lastindexof (searchvalue, [fromindex]) Searches the searchvalue forward from the end of the string and reports the First Instance found.
Substring (Indexa, indexb) obtains the substring from Indexa to indexb.
Tolowercase (), touppercase () converts all characters in the string to uppercase and lowercase.

Date object

To use the date object, you must first create a date instance:

Variable name = new date ();

Method

Getday (), getdate (), gethours (), getminutes (), getmonth (), getseconds (), gettime (), gettimezoneoffset (), getyear ()

And setday ......

Togmtstring () returns the current time in GMT format. (Sun, 12 Feb 1999 14:19:22 GMT)
Tolocalestring returns the current time in locale Format. (03/11/99 14:19:22)
Parse (date) converts a normal date string into a haoss format, and then sets a parameter for settime.

Math object

Attribute

Ln10 (natural logarithm of 10)
Pi (1415926 ...)
Sqrt1_2 (square root of 1/2)

Method

ABS (x) returns the absolute value of X.
ACOs (x) returns the arc cosine value of X.
Asin (x) returns the arc sin value of X.
Atan (x) returns the arc tangent value of X.
Ceil (x) returns the smallest integer greater than or equal to X.
Cos (x) returns the cosine value of X.
Exp (x) returns the X power of E.
Floor (x) returns the largest integer less than or equal to X.
Log (x) returns X's
Max (x, y) returns values in X, Y.
Min (x, y) returns a small value in X and Y.
Pow (x, y) returns the yth power of X.
Round (X) to the nearest integer (rounded off if it is less than or equal to 0.5 decimal places)
Sin (x) returns the sin value of X.
SQRT (x) returns the square root of X.
Tan (x) returns the tangent value of X.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.