JavaScript learning Note--3. System objects

Source: Internet
Author: User

1. Common Object Types

Time (date) object

Math Object

String Object

Regular expression (REGEXP) object

Arrays (Array) objects

2.Date Object ://var date= new Date ();

. GetYear ()//Acquisition Year 13

. getFullYear ()//Acquisition Year 2013

. GetMonth ()//Get month (requires + 1)

. GetDate ()//Acquisition Day

. GetHours ()//acquired

. getminutes ()//Get points

. getseconds ()//Get seconds

. GetDay ()//Get Week (obtained is 0~6, need to use array allocation)

3.Math Object ://Do not need new, direct use

Math.Abs (-200)//Get the absolute value of the number (200 absolute value is 200,-200 absolute value is also 200)

Math.ceil (12.35)//returns the smallest integer greater than or equal to the number (returns 13)

Math.floor (12.95)//returns the smallest integer less than or equal to the number (returns 12)

Math.Round (12.3/12.9)//rounded (return 12/13)

Math.random ()//random

4.String Object ://var str= "ABCdef"

. length//String lengths (this is a property)

. Split ()//split the string to form a string array

. Match ()//Match regular

. CharAt ()//returns the character at the specified index

. substr (1,4)//Returns a string of a specified range

. replace ()//Replace

. toUpperCase ()//turn into uppercase

. LASTINDEXOF ()//returns the location of the last occurrence of the specified character

5.RegExp Object ://var zz=/mode/mode modifier

Refer to the regular syntax for use with a string object

@zhnoah
Source: http://www.cnblogs.com/zhnoah/
This article is owned by me and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original
The right to pursue legal liability.

JavaScript learning Note--3. System objects

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.