JavaScript Object Learning

Source: Internet
Author: User

Object is a very important data type, he is a self-contained data collection, the data contained in the object can be accessed through both attributes and methods;

1. A property is a variable belonging to a particular object;

2. The method is a function that can only be called by a particular object;

The object is a data entity composed of some properties and methods;

The types of objects are divided into:

1. User-defined objects (objects that are customized by JavaScript);

2. Built-in objects

JavaScript within its own definition of objects, such as array,math,date, etc.;

In fact, when we use the New keyword to initialize an array, we are actually creating a new instance of the array object, the following code;

var New false, 123);

The length property of an array object is used to obtain this information when it is necessary to know how many elements a certain number of groups have.

When we new a Date object, the JavaScript interpreter automatically initializes it with the current date and time;

var date=new date ();

The Date object provides a series of methods, such as Getday (), getHours (), GetMonth (), to retrieve all kinds of information related to a particular date;

3. Host Objects

In addition to the built-in objects, you can use other objects that are already predefined in JavaScript scripts. This object is not provided by the JavaScript language itself but is provided by its operating environment, which is the browser, and the predefined object provided by the browser is the host object.

The host object includes Form,image,element,document and so on, we can use this object to obtain information about forms, images and various table elements on the Web page;

JavaScript Object Learning

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.