Core JavaScript objects

Source: Internet
Author: User
1. array object
An array is a common data structure. It is generally used to store a group of identical objects or data.
Main attributes:

Attribute Description

Length

Number of elements in the current array

Prototype

Allow additional attributes to be added to an array object

Common Methods:

Method

Description

Concat

Concatenates two arrays and returns a new group.

Join

Combine all elements in the array into a string and return

Pop

Remove a nonprime from the end of the array and return the value of this nonprime.

Push

Press an element to the end of the array.

Reverse

Returns the array in the original order.

Shift

Removes the first element from the array and returns the value of this element.

Slice

Evaluate the sub-array of the array and return this array

Sort

Sorts elements in an array.

Splice

Insert/delete or replace elements in the array

Tostring

Converts an array to a string.

Unshif

Insert an element at the beginning of the array

2. boolean object
A boolean object is a Boolean encapsulation. A boolean object is used to convert a non-Boolean value to a Boolean value. For a non-Boolean value, use the following rules for conversion.
1. All objects are considered true.
2. the string is considered as false only when it is null,
3. null and undefined are considered false.
4. if and only if the value is zero, the value is false.

3. date object
The date object constructor has the following format:
1. New Date ().
2. New date ("Month day, year hours: Minutes: Seconds ")
3. New Date (yr_num, mo_num, day_num)
4. New Date (yr_num, mo_monum, day_num, hr_num, min_num, sec_num)

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.