Prototype can have a lot of optimized implementation methodshttp://blog.csdn.net/liuqiwen0512/article/details/8089690In JavaScript, each function object has a default property of prototype, called the prototype member of the function object, which points to an object, called the prototype object of the function, and wh
Web page Production WEBJX article introduction: a bit of a tangle of quick prototypes.
As an interactive designer and tool controller, I have always been interested in the topic of prototyping design. Work so far, have used a lot of different types of prototype tools, from the most basic paper pens, to Axure rp/omni graffle, in constant attempts and comparisons, also has been thinking about what the pro
1 What is prototype
The prototype property of an object in JavaScript that returns a reference to the object type prototype. This is a rather awkward explanation, and to understand it, the concept of object type (type) and prototype (prototype) should be understood first.
B
Talking about the JS prototype object and prototype chain, talking about the js prototype
In Javascript, all objects are objects, but objects are also different. They can be divided into two types: common objects and Function objects ).
In general, the objects generated through the new Function are Function objects, and other objects are common objects.
Example:
For the rewrite of prototype prototype objects, we can use the following two ways:
Add the attributes you want to add to the prototype object using the most primitive syntax
function= "Tom"="Doctor"; Person.prototype.sayname=function() { alert (this. name);} var New Person (); Person1.sayname (); // Tom2. Use a simple
Analyze the javascript prototype and prototype chain, and analyze the javascript prototype
Each function we create has a prototype attribute, which is a pointer pointing to a prototype object, the attributes and methods in the prototype
On the prototype and prototype chain of JavaScriptHere, we list several concepts of prototypes, as follows:
Prototype property
[[prototype]]
__proto__
Prototype propertyWhenever a function is created, a property is created for the function
An important part of the interaction designer's work is product prototyping (Prototype design). And the most basic work of the prototype design is to draw the site of the general wireframe (frame diagram) and combined with annotations, a large number of instructions and flowchart, and so on, the complete and accurate presentation of their product prototypes to th
What's the prototype?
A Function type has a property prototype, which translates directly into a prototype. This property is a pointer to an object that contains properties and methods that are shared by all instances (objects) generated by the current function.
This sentence according to the preceding, carefully pondering down, you can get the following code:
ExtJs -- 09 -- three methods of javascript Object writing prototype: the most efficient way to set prototype through prototype
/*** Recommended three methods for writing javascript objects. The third method is recommended for execution efficiency. */function P (name, age) {this. name = name; this. age = age; // method 1 this. show = function () {alert (this. nam
Details about prototype and prototype chain in JavaScript -- Item15
Those who have used JavaScript must be familiar with prototype. However, this makes it difficult for beginners to understand that a function has a prototype attribute, you can add functions for it for instance access. The rest is unclear. Recently, I r
Prototype prototypes:I. Relationship of functions to objects1. A function is one of the objects (the function is the object type)Example: function fn1 () {...}Console.log (fn1 instanceof Object);Returns true, stating that the function (FN1) is an object type.2. The object is created by the functionExample: var obj = new Object ();var arr = new Array (3);Arr[0] = 0;ARR[1] = 1;ARR[2] = 2;Console.log (typeof Object); Obj is created by objectConsole.log (
choice for the preliminary design of web products, because: simple enough to help the website designers quickly and easily create directory-based organization-based prototype documents, function descriptions, interactive interfaces, and annotated wireframe webpages, the webpage files and Word documents used for demonstration can be automatically generated to provide demonstration and development;
2. Axure
One, instanceof:instanceof detects if there is a prototype prototype on the right side of the __PROTO__ prototype chain on the left. I've been in two previous articles[JS Master's Road] the basic characteristics and advantages and disadvantages of the constructor function[JS Master's Road] step-by-step graphical JavaScript pr
In-depth analysis on prototype of ctipt PT: Is prototype attributes a copy, a reference, or a fixed search method?
---- 01 _ modifying prototype attributes//
//
Output:
After the instance is created, person1.username: zhangsanAfter the instance is created, person2.username: zhangsan
After the prototype is modified, per
Understanding the prototype and prototype chain in javascript, understanding the prototype of javascript
Prototype
As we all know, JavaScript does not contain the traditional class inheritance model, but uses the prototype model. Code implementation is like this.
function S
We proceed as above, we have solved the method sharing problem of multiple instances by prototyping, then we will figure out the prototype of the prototype and the context of the prototype chain.1 functionCreateobj (uName) {2 This. UserName =UName;3 }4CreateObj.prototype.showUserName =function(){5 return This. UserName;6
Javascript: traversing the prototype chain, calling stack, and scope chain
In JavaScript, there are three common chain structures: prototype chain, call stack (Call StackScope chain. This article does not want to talk about the basic knowledge of these concepts, but rather shows how to traverse the three chain structures to deepen understanding. Traverse prototype
In-depth analysis on prototype of ctipt PT: Is prototype attributes a copy, a reference, or a fixed search method?
---- 02 _ add prototype attributes
//
//
Output:
After the instance is created, person1.username: zhangsanAfter the instance is created, person2.username: zhangsanBefore adding the property age to the prototy
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.