jump to content
Here I would like to show the possibilities of object-oriented programming in JavaScript repairation is an interesting aspect, but especially why you are. To this end, we scrutinize the inner workings of JavaScript is this point of view: I dare boldly to approach forming on Article will be discussed. These internal mechanisms defined by the ECMAScript specification, so as not only are valid JavaScript, but any language based on this standard will be applied, for example, can be useful for those engaged in ActionScripttel. In writing an article - inspired by wl-list thread - started by Tibor Balogh; a lot of material found on this topic, but none of them TALE is a very important topic: what mechanisms are hidden in the background. Of course a great elboldogulhatunk without this knowledge, but if you know them better we will be able to solve non-standard problems, then we will be confronted with a tricky use proposal, the article is about which usually is not mentioned, and in light of the upcoming and seem simple, logical solution. As also mentioned in the introduction, these operating rules are contained repairation in the ECMAScript specification, which conducted the development of the same organization (Ecma International), such as C # or Eiffel standardization. JavaScript is an object-oriented language, in which every object, even functions. An object has properties. A property is determined by the name, and it has a value and attributes. The value can be an object, a primitive value (undefined, null, boolean, string, number) or method (function object). The attributes internal purposes, can not be achieved directly, it can not be them; four of them: ReadOnly: the property is read-only, write attempt repairation without any effect. DontEnum the property not be listed, for example, does not appear in a for loop. DontDelete the property can not be canceled without any cancellation remains in effect experiment. Internal: for internal use property. Creating objects differently from the other language classes are not explicitly JavaScript. Objects from simple functions to create that uses the constructor with the new operator repairation work in them falling code to create the object properties (or some of them). In this case the function of this variable represents the object to be created, as shown in the following example: repairation
classFoo function () {this.propFoo = 5; ObjFoo} var = new classFoo (); alert (objFoo.propFoo); / / 5 The prototype property of each function object has a special role to judge the prototype property names, which are themselves objects, and that the default value for the built-in Object object. When the function constructor is used, and can help you create an object arises in them an internal reference to them establishing a constructor prototype property of, which in turn is also an object, so you can have an internal reference for establishing repairation it constructor prototype property of, and so on: ultimately will belong to each object in a prototype chain, which is located at the end of the Object. Let's repairation find out why it is important for us in the prototype chain. Reading skills, writing is one of the important mechanisms to be discussed unlock feature links what happens when you use or set their value. Writing simple repairation case: if the object of the property (and the ReadOnly attribute is not true) the given name already exists, repairation its value will be overwritten if it does not exist, then create a new with the specified name and value. The read-out has been a bit complicated process. If the object has a given property, we get the value back. If not, it will be examined in the next element in the prototype chain, and this continues until one object will not contain the searched property or do not mark the end of the chain. In the latter case, the reference value will be undefined. Maybe you can also have a prototype-based inheritance is based on how you are going to prototype-based inheritance for JavaScript. If a constructor (function repairation object) create a prototype of a property, you will be shown the object is created by each of these constructors. If the prototype of a whole object is added value, that means that all of its properties will appear in the child object. Eagle-eyed readers may notice this straight out of the fact that a constructor under the above-defined property "masks" of the same name may already exist in the prototype property.
classFooParent function () {this.propFoo
Here I would like to show the possibilities of object-oriented programming in JavaScript repairation is an interesting aspect, but especially why you are. To this end, we scrutinize the inner workings of JavaScript is this point of view: I dare boldly to approach forming on Article will be discussed. These internal mechanisms defined by the ECMAScript specification, so as not only are valid JavaScript, but any language based on this standard will be applied, for example, can be useful for those engaged in ActionScripttel. In writing an article - inspired by wl-list thread - started by Tibor Balogh; a lot of material found on this topic, but none of them TALE is a very important topic: what mechanisms are hidden in the background. Of course a great elboldogulhatunk without this knowledge, but if you know them better we will be able to solve non-standard problems, then we will be confronted with a tricky use proposal, the article is about which usually is not mentioned, and in light of the upcoming and seem simple, logical solution. As also mentioned in the introduction, these operating rules are contained repairation in the ECMAScript specification, which conducted the development of the same organization (Ecma International), such as C # or Eiffel standardization. JavaScript is an object-oriented language, in which every object, even functions. An object has properties. A property is determined by the name, and it has a value and attributes. The value can be an object, a primitive value (undefined, null, boolean, string, number) or method (function object). The attributes internal purposes, can not be achieved directly, it can not be them; four of them: ReadOnly: the property is read-only, write attempt repairation without any effect. DontEnum the property not be listed, for example, does not appear in a for loop. DontDelete the property can not be canceled without any cancellation remains in effect experiment. Internal: for internal use property. Creating objects differently from the other language classes are not explicitly JavaScript. Objects from simple functions to create that uses the constructor with the new operator repairation work in them falling code to create the object properties (or some of them). In this case the function of this variable represents the object to be created, as shown in the following example: repairation
classFoo function () {this.propFoo = 5; ObjFoo} var = new classFoo (); alert (objFoo.propFoo); / / 5 The prototype property of each function object has a special role to judge the prototype property names, which are themselves objects, and that the default value for the built-in Object object. When the function constructor is used, and can help you create an object arises in them an internal reference to them establishing a constructor prototype property of, which in turn is also an object, so you can have an internal reference for establishing repairation it constructor prototype property of, and so on: ultimately will belong to each object in a prototype chain, which is located at the end of the Object. Let's repairation find out why it is important for us in the prototype chain. Reading skills, writing is one of the important mechanisms to be discussed unlock feature links what happens when you use or set their value. Writing simple repairation case: if the object of the property (and the ReadOnly attribute is not true) the given name already exists, repairation its value will be overwritten if it does not exist, then create a new with the specified name and value. The read-out has been a bit complicated process. If the object has a given property, we get the value back. If not, it will be examined in the next element in the prototype chain, and this continues until one object will not contain the searched property or do not mark the end of the chain. In the latter case, the reference value will be undefined. Maybe you can also have a prototype-based inheritance is based on how you are going to prototype-based inheritance for JavaScript. If a constructor (function repairation object) create a prototype of a property, you will be shown the object is created by each of these constructors. If the prototype of a whole object is added value, that means that all of its properties will appear in the child object. Eagle-eyed readers may notice this straight out of the fact that a constructor under the above-defined property "masks" of the same name may already exist in the prototype property.
classFooParent function () {this.propFoo
No comments:
Post a Comment