This article is the second part of the study notes series. It briefly introduces the related knowledge from the javascript Object and array parts, and attaches a detailed example, which is very practical, for more information, see
Javascript Object Section
I. Basics
1. All variables in JavaScript are objects, except for null and undefined.
2. Jscript supports four types of objects: internal objects, generated objects, and objects provided by the host (all BOM and DOM objects are host objects .) And ActiveX objects (external components ).
3. Microsoft Jscript provides 11 internal (or "built-in") objects. They are Array, Boolean, Date, Function, Global, Math, Number, Object, RegExp, Error, and String objects.
4. The object is only a special type of data. The object has attributes and methods. JavaScript is an object-oriented language, but JavaScript does not use classes. JavaScript is based on prototype rather than class.
5. attribute: a variable that belongs to a specific object. Method: it is a function that can only be called by a specific object.
6. A Jscript object is a set of attributes and methods. A method is a function that is a member of an object. An attribute is a value or a group of values (in the form of an array or object) and a member of an object.
7. javascript objects are based on constructors. When using constructors to create a new object, it can be said that a new object is instantiated. Attribute is the variable inside the constructor function.
Objects instantiated using constructors:
Cat = new Animal ();
8. Javascript is an object-based language. Almost everything you encounter is an object. However, it is not a real Object-Oriented Programming (OOP) language, because its syntax does not contain class ).
The Code is as follows: