The same is true for objects in JS. everything is object, which is the basis of everything. An object is a collection of variables and functions. Objects are generally derived from classes, and Classes define the attributes and methods of objects. If all your scripts are interactive operations between objects, you can say that this script is an object-oriented script. JavaScript is a prototype-based object-oriented language. It does not have the concept of classes. Everything derives from a copy of an existing object. Objects in JS are divided into two types: 1. Function objects. For example, the alert () Function can use parameters to change the functions of such objects, such as alert ('kfkf'); 2. Object objects, such objects cannot be called as Function objects and have fixed functions. Javascript inheritance in JS is prototype-based object-oriented, which leads to the inability to extend the underlying class structure of another class from one class. Inheritance in JS is implemented by simply copying methods from an object prototype to another object prototype. Let's take a look at the following example: [javascript] <script type = "text/javascript"> function init () {var person = new Object (); person. getName = function () {alert ('person name');} person. getAge = function () {alert ('person age');} // create another Object var student = new Object (); // create a method student. getStuNum = function () {alert ('student num') ;}; // inherit the getName Method student of person. getName = person. getName; // redefines the getName method of person. getName = function () {Alert ('person1 name');} student. getAge = person. getAge; student. getName (); person. getName ();} window. onload = init; </script>: In this example, we can understand the above content. Object member object = associated array = property package = storage body in javascript only objects access operation prototype/Object Property package prototype only exists in function, after an object is created, creates an empty prototype object by default. Since the object is an attribute package, the prototype is also an attribute package. When reading in the prototype, read from the prototype chain, and write to yourself when writing. See the following example: [javascript] <script type = "text/javascript"> function object2 () {}; function object3 () {}; object3.prototype = new object2 (); object. prototype. foo = function () {alert ('object. prototype. foo ') ;}; aObj = new object3 (); aObj. foo (); object2.prototype. foo = function () {alert ('object2. prototype. foo ');}; aObj. foo (); </script> running result: First Time: object. prototype. foo: object2.prototype. foo can help understand: the window object overwrites the scope chain. See the following example: [javascript] <script type = "text/javascript"> function override () {var alert = function (message) {window. alert ('override' + message) ;}; alert ('alert '); window. alert ('window. alert ');} override (); window. alert ('window. alert from outside '); </script>