Home > Article > Web Front-end > What objects does javascript support?
JavaScript supports three types of objects: 1. Built-in objects, including String, Number, Boolean, Array, Date, RegExp, Math, Error, Object, Function, and Global; 2. Browser objects; 3. Auto Define objects.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript objects are collections of related properties and methods. JavaScript supports three types of objects: built-in objects (native objects), browser objects, and custom objects.
1. JavaScript built-in objects:
refers to the predefined objects of the JavaScript language itself, defined in the ECMAScript standard and used by all browser manufacturers To provide specific implementation, due to the unification of standards, the browser compatibility problem of these objects is not too big
String, Number, Boolean, Array, Date, RegExp, Math, Error, Object, Function, Global
2. JavaScript Window - Browser Object:
The Browser Object Model (BOM) allows JavaScript to talk to the browser .
There is no official standard for the Browser Object Model (BOM). Modern browsers have implemented (almost) the same methods and properties for JavaScript interaction, so it is often mentioned as a method and property of the BOM.
Methods and properties are often considered BOM because modern browsers have implemented (almost) the same methods and properties for JavaScript interactivity.
Window object:
All browsers support the window object. It represents the browser window.
1), the window object is the top-level object;
2), the window object has 6 major attributes, including: document, frames, history, location, navigator, screen, these 6 major attributes The properties themselves are also objects;
3), the document properties under the window object are also objects, and there are also five major properties under the document (anchors, forms, images, links, location) that are also objects.
3. JavaScript custom objects:
Through JavaScript, you can define and create your own objects.
There are two different ways to create a new object:
Define and create an instance of the object
Use functions to define object, and then create a new object instance
Create a custom object:
var person=new Object(); person.firstname="John"; person.lastname="Doe"; person.age=50; person.eyecolor="blue"; document.write(person.firstname + " is " + person.age + " years old.");
[Recommended learning:javascript advanced tutorial】
The above is the detailed content of What objects does javascript support?. For more information, please follow other related articles on the PHP Chinese website!