JavaScript built-in objects

Source: Internet
Author: User

Built-in objects are equivalent to built-in constructors
The built-in objects are broadly divided into three categories:
Data encapsulation Class object--object, Array, Boolean, number, and string
Tool Class object--math, Date, regexp, etc. to provide traversed objects
Error class objects-including generic error objects and various other more special error class objects

Object: Parent object for all objects
To create an empty object:
var JX = {};//Object text identification method
var jx = new Object ();//object constructor function
Contains the methods and properties:
constructor properties for constructor//constructors
ToString ()//Returns the description string for the object
ValueOf ()//return to the object itself

Array: Building the built-in constructor function of an array, also an object (typeof Jx-->object)
var jx = new Array ();
var JX = [];

Abnormal phenomena
var JX = new Array (single digit);//Create an array of numeric lengths

Some special places relative to the object:
Property names are incremented from 0, and values are automatically generated
Have the Length property
Extended built-in methods on parent objects

Interesting array methods
Sort ()//sorting, small to large
Join (optional character)//string to concatenate all elements in the array
Slice (start,end)//Returns one of these fragments without modifying the target array, with a base of 0
Splice (Start,end, new Element)//Modify the target array, replace the modified array with the new element
Push ()//end add a new element jx[jx.length] = new
Pop ()//end Delete an element jx.length--

JavaScript built-in objects

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.