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
Note: The built-in function object Funtion prototype prototype is an instance of object , but it is a function type.Function. prototype instanceof Object; true ---is an instance of Objectfunction. prototype instanceof
Comparison between Function. prototype. apply () and Function. prototype. call () in javascriptThe apply () method can call a function or method while using a specified this value and a parameter array (or an array of classes. The call () method is similar to apply (). The d
This article from: http://www.blogjava.net/heavensay/archive/2013/10/20/405440.htmlIntroduction of prototype, __PROTO__, Constructor, Object and function relations in JSAn Introduction to Prototype, __proto__ and object, function relationsfunction, Object:js functions object. Prot
Next part: Prototype source code analysis -- function. Prototype part (1)
A Rough Review of the previous
In one example, there are two roads:
function handler(greet){ console.log(greet,this.name); }var obj = { name : 'xesam' }
1. Use call or apply to change the handler's scope, handler. Call (OBJ, '
http//www.cnblogs.com/cmptlgg/my Blog Parkoverriding the Prototype property value of a function object: the connection of the [[Prototype]] internal properties of the instance and the Prototype (prototype object) of the original function
The Class in Prototype is generally created using the Class. create method, for example, PeriodicalExecuter type. You can call newPeriodicalExecuter (xxx) to generate an object.
The Code is as follows:
/*** A well-designed timing actuator* First, a PeriodicalExecuter type is created by Class. create,* Configure the prototype in the syntax of the object quantity directly.** It must be particularly noted t
This article , referring to Http://www.blogjava.net/heavensay/archive/2013/10/20/405440.html's article, makes a brief summary of its contents, and forms a few simple conclusions. It makes it easier for readers to remember the relationship between prototype, __proto__, Object, and function. Conclusion 1:Object.prototype is just an ordinary object, it is the top of the JS
Recently I learned nothing about what I think, and the progress is not obvious. So I occasionally look at the prototype source code and take notes for analysis.
I remember that when I used to look at jquery's source code, I searched the internet and analyzed a bunch of source code. However, most of them can only be regarded as comments. I am a beginner like me.
So now, jquery's source code only looks at the first few hundred lines. Select
completely new objects that have new addresses in memory, and often modifications to the objects produced by the clones have no effect on the prototype object, each of which is independent of each other. Vi.. Expansion:A brief introduction to shallow cloning and deep cloning:(1) In the Java language, data types are categorized into value types (base data types) and reference types , and value types include
Creating object objects directlyvar New Object (); var = {};stu.name= "Zhangsan"="stu"function() { alert ( "My name Zhang San"); }You can also use the Stu as a module, the module has a number of objects, the following example for a simple shopping cart system module!Shoppingcar.carinfo = function (obj) {Shoppingcar.carinfo . Carnumber = Obj.carnumber;.....}//Shopping Cart ObjectShoppingcar.orderinfo =
Doubts come from:
Copy Code code as follows:
function Foo {
this.name = ' Foo ';
}
Alert (Foo.prototype = = Function.prototype); False I was wondering why Foo's prototype was not function.prototype.
The following example lets me take it for granted that O.prototype = = Function.prototype should be true:
Copy Code code as follows:
call is in the source program composed of multiple source files, the organization function definition declaration that is unfavorable to code is the function prototype declaration
Double square (double x)
{return
x * x;
}
int main (void)
{
printf ("%f\n", Square (3));
return 0;
}
4 function
method are completely new objects that have new addresses in memory, and often changes to the objects produced by the clones have no effect on the prototype object. Each cloned object is independent of each other. Vi.. Expansion:Brief introduction of Shallow clone and deep clone:(1) In the Java language. Data types are divided into value types (base data types) and reference types . Value types contain sim
not, the client needs to replicate the prototype object on its own.Under what circumstances is prototype mode used? It is assumed that the product class of a system is dynamically loaded, and that the product class has a certain hierarchical structure. At this time, if the factory model is adopted, the factory class has to have a corresponding hierarchical structure. Once the grade structure of the product
Prototype Learning Tool functions $ H, $ R, Try. these, document. getElementsByClassName $ H are convenient methods for creating Hash objects. For details about Hash objects, refer to [Prototype Learning-Hash objects]
$ R is a convenient method for resume ObjectRange objects. For details about ObjectRange objects, refer to [Prototype Learning-ObjectRange objects]
This article address: http://www.cnblogs.com/archimedes/p/java-prototype-pattern.html, reprint please indicate source address.Prototype modeUse the prototype instance to specify the kind of object to create and create a new object by copying the prototypes.OverviewThe prototype pattern is a mature pattern of starting f
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.