, Boolean, String, function, object, undefined
However, if we want to differentiate specific classes such as date and Regexp, there is no way for typeof, so it is unified into the object.
Let's take a look at some definitions in prototype:
NULL_TYPE = 'Null', UNDEFINED_TYPE = 'Undefined', BOOLEAN_TYPE = 'Boolean', NUMBER_TYPE = 'Number',
This object is a few extensions to the function, the most important of which is the bind method, Prototype's help document specifically said: Prototype takes issue with only one aspect of functions: Binding. Where The Wrap method is also important, within the class inheritance mechanism is the use of the Wrap method to invoke the same method of the parent class.
Argumentnames
Bind
Bindaseventlistener
Curry
The previous day, I analyzed the prototype function. Today, the prototype object part is started.It should be noted that the object part is a little different from the previous function part. This time, the object is directly extended on the
Copy Code code as follows:
/* Based on Alex Arnell ' s inheritance implementation. */
var Class = (function () {
Temporarily store Parent's prototype
function subclass () {};
Ways to create a class
function Create () {
var parent = null, properties = $A (arguments);
Check whether a parent object is specified when a new class is created
If the parent class is specified, assign to parent
if
This article describes the prototype attribute in JavaScript. This attribute is an important basis for understanding JavaScript classes and inheritance. We have used prototype property simulation class and inheritance implementation in Chapter 1. The prototype attribute is essentially a JavaScript Object. Each function
This article mainly introduces how to use Prototype to implement object-oriented methods in JavaScript. examples show how to use Prototype attributes, which is of great practical value, for more information about how to use Prototype to implement object-oriented JavaScript,
Inherited: Inheritance is a relatively central concept in object-oriented. Other Orthodox object-oriented languages can be implemented in two ways Commitment: One is an interface implementation, and the other is inheritance. While ECMAScript only supports inheritance, it does not support interface implementations, and realThe way it is inherited relies on the prototype
We all say that JavaScript properties are many, can not remember, various structures are difficult to understand. Indeed JS is a quick way to improve the difficult language, but there are other ways to assist the memory. The following is to discuss the JS of a major difficulty-object layout, exactly how the person who designed JS this language was how to do? What did you become when you finished the design?Let's look at a picture:I believe you are not
I. CausePrototype was used that day. javascript is so confused when you open it and check a few lines. The reason is that you are not very familiar with js object-oriented methods, So Baidu + google finally made a small gain, write this to commemorate ^_^.Prototype. js code snippetCopy codeThe Code is as follows:Var Class = {Create: function (){Return function (){This. initialize. apply (this, arguments );}
JavaScript uses Prototype to implement the object-oriented method. javascriptprototype
This example describes how JavaScript uses Prototype to implement object-oriented methods. Share it with you for your reference. The specific analysis is as follows:
Prototype is an attr
We all have a misconception that the prototype chain, which forms the Javascript object, is a prototype with a name of prototype and can be accessed. In fact, the prototype of Javascript and the property named prototype have no re
This article mainly introduces how to use Object in JavaScript. prototype. toString determines whether it is an array. This article describes the Object. prototype. toString related knowledge, and provides the implementation code to judge the array. using this method, you can also determine other data types of javascrp
Enumerable provides a large set of useful methods for enumerations, which is, objects ' act as collections of values. It is a cornerstone of Prototype.Enumerable is what we are module:a consistent set of methods intended not for independent with but for Mixin: Incorporation into the other objects that ' fit ' with it.Quite a few objects, in Prototype, mixes enumerable in already. The most visible cases are Array and Hash, but you'll find it in less ob
When I was learning JavaScript's prototype object, I always did not consciously take the Java class thought to do the comparison, the time is long, I gradually realized that the two have the huge difference.First, the class is not directly run as a method, its simplest way is to call its static method, and the prototype objec
This article mainly introduces how to use Prototype to implement object-oriented methods in JavaScript. examples show how to use Prototype attributes, which is of great practical value, for more information about how to use Prototype to implement object-oriented JavaScript,
This chapter discusses using the new constructor to create an object.Pre-Knowledge point description:1. Prototype is a property of a function, and each function has a prototype property. This property is a pointer to an object. It is a property that displays the prototype of the modified
There are three of objects in JavaScript1, internal objects
such as array,boolean,data,math,number,object,regexp,string objects, etc.
These object systems provide us with their own properties and methods for invocation.
2, class-based objects
Implements references to objects in the form of classes that require our own definition
3, based on the prototype
First code:
function Human () {}
Human.prototype.name = "Genghis Khan";
Human.prototype.sex = "male";
Human.prototype.say = function () {
alert (this.name);
var man = new Human ();
Man.say (); Genghis Khan
var woman = new Human ();
Woman.say (); Genghis Khan
alert (Man.say = = Woman.say);//true
Prototype is one of the very core points of knowledge in JavaScript. He is an important part of the object-orie
What is a prototype object? In JS, each created function has a prototype attribute, which points to an object, which is the prototype objectfunctionResults from the Chrome browser: What are prototype objects capable of?First, whe
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.