JavaScript Object Classification Summary and method of creation

Source: Internet
Author: User
Tags object model

before the website construction of JavaScript event object and code writing, we today to summarize the site construction of all the objects JS, event object refers to the DOM event object, and JS object scope is larger, Below we comprehensively summarize the website JS Object Classification summary and the difference.
I. What is a website JS object? What are the categories? What are the specific attributes?
In Font-family:-apple-system-font, "helvetica=" "sans=" "font-size:=" "1. Browser object: That is, the BOM, refers to the object model of the browser, its properties include browser open, close, size changes, Window movement and so on;
2. Web Document object: That is, the DOM, refers to the HTML page of the object model, his content and attributes include all the content on the page, elements and so on;
3. Event object, that is, DOM event, which belongs to the DOM Web Document object, the main properties include handle event, mouse keyboard event, etc.
4. Built-in objects: Refers to some of JavaScript's most basic methods of functional objects, including numeric objects, string objects, array objects, and Date function objects, and so on; Two. Can JS customize the object in website construction? What are the methods?
JS is a customizable object, there are two ways to do it:
1. Define and create objects directly, and the code demonstrates the following:
People=new object (); Here a new object is created with the keyword new;
People.name= "Xiaoming"; Set properties by using the object. Custom keywords;
Deocument.write ("Name:" +people.name+ ";") Print out objects by document
2. Define and create the object through the function, with the following code:
function people (Name,age) {
This._name=name; Use this to index
This._age=age;

Son=new people ("xiaoming", 18)
document.write ("Name:" +son._name+ ", Age:" +son_age)
The above content is about the summary of JS object classification and how to customize the object, this article by Gongyi website production-Gongyi full stack network studio provided.

JavaScript Object Classification Summary and method of creation

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.