This section briefly introduces the principle of the _ proto _ attribute in javascript, and javascript _ proto _
In javascript, we will agree that if a method is used by a new method, the first letter of the method name is usually capitalized, such as the Person in the following code block. (We can also regard Person as a class in java or c)
var Person = function(name) { this.name = name;}
The process o
The relationship between prototype and _ proto _ in Javascript is described in detail. prototype _ proto _
Preface
When I learned the prototype, I felt my head was too big )/~~ In particular, prototype and _ proto _ are too stupid to find out more information. Based on your understanding, the following is a summary:
1. constructor:
Constructor: The new Keyword ca
There's a lot of chaos in the JavaScript relationship. The scope chain is a one-way chain relationship, which is simple and clear; the invocation relationship of this mechanism is somewhat complicated, while the prototype is the triangular relationship between prototype, Proto and constructor. This article first uses a diagram to begin with, and then explains the triangular relationship of the prototype in detail.
Icon
Concept
The complex relations
Here we will discuss the relationship between the object's internal prototype (_ proto _) and the prototype of the constructor.
1. All Constructors/functions _ proto _ point to Function. prototype, which is an Empty function (Empty Function)
Copy codeThe Code is as follows: Number. _ proto _ = Function. prototype/true
Boolean. _
Prototype: each function object has a displayed prototype attribute, and each proto object has an internal hidden attribute named _ proto. This article introduces the relationship between prototype and proto in JavaScript. For more information about prototype, see prototype. Each Function object has a displayed prototype attribute, which represents the prototype
I want to learn about prototype, getPrototypeOf, and _ proto __of javascript. I have learned three methods for accessing prototype. If you are interested, refer to section 1. Understanding prototype in depth, getPrototypeOf and _ proto _
Prototype, getPropertyOf, and _ proto _ are three methods used to access prototype. Their naming methods are similar, so they
This article describes in detail the internal prototype _ proto _ of javascript and the prototype of the constructor, as well as the similarities and differences between them. It is very detailed. If you need it, come and study it. _ Proto _ is the internal prototype, and prototype is the constructor prototype (the constructor is actually a function)
The prototype of the constructor is an object.
So what i
For details about _ proto _ and prototype in javascript, __proto_prototype
_ Proto _ is the internal prototype, and prototype is the constructor prototype (the constructor is actually a function)
The prototype of the constructor is an object.
So what is the constructor?To create an object, you must first have an object constructor, just like in php. To create an object, you must first have a classThe constr
Baidu Antivirus 3.0 installation and UI
Baidu Antivirus online installation files can be described as many of the smallest kill soft, only 1.71M. And online installation has a benefit, that is, automatically download the latest and most stable version of the Kill soft, each download to the latest version of the antivirus Baidu.
Figur
From: http://www.cnblogs.com/zzcflying/archive/2012/07/20/2601112.html
var
Person =
function
(name) {
this
.name = name;
}
var
p =
new
Person();
newOperator operation isvarp = {};p.__proto__ = Person.prototype;Person.call(p);
VaR P = {}; that is, initialize an object p.
P. _ PROTO _ = person. Prototype;
Person. Call (P );
That is to say, Constructing P can also be called initializing p.
The key lies in the second step. Let's prove it:
This article mainly introduces the _ proto _ attribute in JavaScript. For the so-called object in JavaScript, it points to the prototype of the object, if you need it, you can refer to JavaScript as an object-oriented speech, that is, everything is an object.
So how to generate an object? In the Java World, objects are produced by Class instances. In other words, objects are abstracted into a mold using this mold (Class) produce specific objects ).
H
The _ PROTO _ attribute of an object and its internal attribute [[prototype] point to the same value (usually referred to as the prototype ), the prototype value can be an object value or null (for example, object. prototype. the value of _ PROTO _ is null ). this attribute may cause some errors, because the user may not know the particularity of this attribute and assign values to it, thus changing the pro
-execute-objectivec/devtools/full_mac_build.shAfter execution, you will see that the PROTOC binaries are generated in the SRC directoryUsing the PROTOC conversionCreate a proto file, such as Person.proto"proto3";message Person{ int32 age = 1; string username = 2; string phone = 3;}
1
2
3
4
5
6
7
1
2
3
4
5
6
7
It is important to note whether the syntax rules for
Protobuf is a cross-platform message interaction protocol, such as XML, JSON, and so on.Protocolbuffer (PB) is a format for Google's data interchange, which is independent of the language and is platform independent.Google offers implementations in multiple languages: Java, C #, C + +, go and Python, each of which contains compilers and library files for the appropriate language.Because it is a binary format, it is much faster than using XML for data exchange. It can be used in data communicatio
When communicating with WebSocket on the back end, it is a chore to bring a proto file to the front end. The first is the obvious exposure of the protocol entity object, and then a browser client can easily cache the file, the new protocol update may cause the client to be unable to use, in addition to the CDN server also need to configure. The proto type client can download the past. Really legacy, they us
Antivirus software is almost every computer must be products, with the increasing computer technology, almost every person who uses computers have encountered computer viruses, so antivirus software is also less than necessary. However, the virus and anti-virus software to understand many people still have a misunderstanding. Although anti-virus software can help the computer to intercept most viruses and k
Bug Example
Protobuf-lua has a bug:
An error occurs when you import other proto message types
If there are two Proto:reward and mail.Where Mail's proto imported the reward message type
Reward.proto is as follows:
Package reward;
Message reward
{
optional UInt32 money = 1;
}
Mail.proto is as follows:
Import "Reward.proto";
Package mail;
Message Mail
{
optio
1 , installationDownload Google Proto Buff . unzip the downloaded package and read the README.txt , according to the instructions inside the installation. $./configure$ make$ make Check$ make Installno accident, the first three steps should be completed smoothly, the fourth step, the need for root permissions. I adopt the default path, so, only with root permissions, or can not install, you must first Create a new Lib under the/usr/local directory,
Recently working on a project based on the Netty framework.The project uses Google's PROTOBUF as the codec framework. (XML or JSON is not used for better efficiency).After a period of use I have a simple summary of how to use Protobuf's original files.I'm mainly here to illustrate the original file. Proto, modifier repeated, required, optional difference.0.windows Environment, Java Engineering1. After installing PROTOBUF, locate Protoc.exe2. Write a c
Javascript _ proto _ (note that both the front and back are underlined) and prototype can both access the prototype of the object. Is there any difference between them?
Yes, __proto _ can only be accessed using objects. prototype can only be accessed by class.
The following is a simple example:
/*** Implement simple inheritance using prototype mode */function per () {this. getName = function (str) {alert (str) ;}} per. prototype. getAge = functio
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.