原型和Prototype.js之间的关系 [英] relation between prototype and Prototype.js

查看:87
本文介绍了原型和Prototype.js之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我对原型与原型之间的关系感到非常困惑。并且

表示Prototype.js似乎被大量使用的图书馆

(如果我理解

正确的话,不是来自这个小组的知识渊博的人)。


例如,当我这样做时,我使用关键字(?)" prototype":


函数示例(){

...

}


Example.prototype.val = undefined;

它与Prototype.js之间的关系是什么?图书馆?


这个名字简直令人困惑,还是让我感到困惑?

(两个?)


PS:我刚刚开始使用Javascript ...

解决方案

sh ****** @ yahoo.fr 写道:

大家好,

我是非常混淆原型之间的关系。和那个Prototype.js似乎被大量使用的图书馆
(如果我理解正确的话,不是来自这个小组的知识渊博的人)。

例如,当我这样做时,我使用关键字(?)" prototype":

函数示例(){
...
}

Example.prototype.val = undefined;

与Prototype.js之间的关系是什么?图书馆?

这个名字简直令人困惑,或者我只是简单地困惑?
(两个?:)



只是简单的混淆! />

忘记Prototype.js并学习如何使用核心JavaScript。

一旦你掌握了语言的速度,你将会更好。 />
评估工具包的位置。


-

Ian Collins。


shypen42说:

大家好,

我对原型与原型之间的关系感到非常困惑。和那个Prototype.js似乎被大量使用的图书馆
(如果我理解正确的话,不是来自这个小组的知识渊博的人)。

例如,当我这样做时,我使用关键字(?)" prototype":

函数示例(){
...
}

Example.prototype.val = undefined;

与Prototype.js之间的关系是什么?图书馆?

这个名字简直令人困惑,或者我只是简单地困惑?
(两个?:)

PS:我刚刚开始使用Javascript ...




''prototype''与javascript的基于对象的一面有关 - 你不需要
需要了解这一点,除非你想建立自己的自定义对象。

你可能最好只学习语言的基础知识。


''Prototype.js''是一个预先编写的javascript代码库,您可以使用它来使b / b
更容易设计跨平台的js应用程序。除了其他

之外,该工具包的设计者还将解决所有棘手的错误

错误,这些错误会阻止代码在所有浏览器上运行,并且封装了

这是一个简单的api,它可以按你想要的方式工作。即你编写代码

做你想做的事情而不管浏览器,他们的代码排序

如何在Internet Explorer上实现这个的细节

与Firefox等相比。这可能值得学习,但可能只有在你有一些练习先编写简单的东西之后才能获得



-
http://www.niftybits.ukfsn.org/


删除''nul-l''给我发电子邮件。除非通过主题行中的[html]或[attachment]通知,否则HTML邮件或附件将包含在垃圾邮件中。


< blockquote> sh******@yahoo.fr 写道:

我''我很困惑原型和Prototype.js之间的关系。似乎被大量使用的库(如果我理解正确的话,不是来自这个
组的知识渊博的人)。

编写Prototype.js的人并不是很熟悉用javascript

(显然不喜欢他们现在对它的所作所为,所以试图使用'b $ b'使它'更像''另一种语言更符合他们的喜好)。这里写的大多数人都像javascript一样(很多人都理解它,或者更多或者更少的b / b)所以他们(我们)没有多少用处那个库。

例如,当我这样做时,我使用关键字(?)
" prototype":


它不是一个关键字。 Javascript的关键字在ECMA 262第3版定义

名称,当函数被用作构造函数作为vlaue的源时使用。构造对象的内部

[[Prototype]]属性。对象的内部

[[Prototye]]属性是javascript对象如何从其他对象继承

proerties。

函数示例(){
...


Example.prototype.val = undefined;


所以,如果一个对象是用以下构造的: -


var obj = new Example();


- 结果对象本身没有 - val - 属性,但是它确实通过其内部[[Prototype]]属性继承了一个,这是

从 - 示例 - 函数'(公共)原型中分配了它的值

属性。

它与Prototype.js之间的关系是什么?图书馆?


Prototype.js的名称库是任意的,与javascript中使用的原型继承没有明确的

关系(巧合除了

)。

这个名字是不是很简单令人困惑


这个名字肯定令人困惑。

或者我只是很困惑?
(两个?:)



您可能也会感到困惑;-)


Richard。


Hi all,

I''m very confused by the relation between "prototype" and
that "Prototype.js" library that seems to be used quite a lot
(not by knowledgeable people from this group if I understood
correctly).

For example, when I do this, I use the keyword (?) "prototype":

function Example() {
...
}

Example.prototype.val = undefined;
What is the relation between that and the "Prototype.js" library?

Is that name just plain confusing or am I just plain confused?
(both ? :)

P.S : I''m just beginning with Javascript...

解决方案

sh******@yahoo.fr wrote:

Hi all,

I''m very confused by the relation between "prototype" and
that "Prototype.js" library that seems to be used quite a lot
(not by knowledgeable people from this group if I understood
correctly).

For example, when I do this, I use the keyword (?) "prototype":

function Example() {
...
}

Example.prototype.val = undefined;
What is the relation between that and the "Prototype.js" library?

Is that name just plain confusing or am I just plain confused?
(both ? :)


Just plain confused!

Forget about Prototype.js and learn how to work with core JavaScript.
Once you are up to speed with the language, you will be in a better
position to evaluate toolkits.

--
Ian Collins.


shypen42 said:

Hi all,

I''m very confused by the relation between "prototype" and
that "Prototype.js" library that seems to be used quite a lot
(not by knowledgeable people from this group if I understood
correctly).

For example, when I do this, I use the keyword (?) "prototype":

function Example() {
...
}

Example.prototype.val = undefined;
What is the relation between that and the "Prototype.js" library?

Is that name just plain confusing or am I just plain confused?
(both ? :)

P.S : I''m just beginning with Javascript...



''prototype'' is to do with the object-based side of javascript - you don''t
need to know about this unless you want to build your own custom objects.
You''re probably best off just learning the basics of the language first.

''Prototype.js'' is a library of prewritten javascript code that you can use
to make it easier to design cross-platform js applications. Among other
things, the designers of the toolkit will have worked out all the tricky
bugs that stop code running the same on all browsers, and encapsulated
this in a simple api that just works the way you want. I.e. you write code
to do what you want regardless of the browser, and their code sorts out
the nitty gritty details of how to implement this on Internet Explorer
compared to Firefox, etc. This might be worth learning about, but probably
not until you''ve got some practice writing simple stuff first.

--
http://www.niftybits.ukfsn.org/

remove ''n-u-l-l'' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.


sh******@yahoo.fr wrote:

I''m very confused by the relation between "prototype"
and that "Prototype.js" library that seems to be used
quite a lot (not by knowledgeable people from this
group if I understood correctly).
The people who wrote Prototype.js were not very familiar with javascript
(and apparently did not like what they did now about it, so tried to
make it ''like'' another language more to their liking). Most of the
people writing here like javascript (and many understand it, more or
less, as well) so they (we) don''t have much use for that library.
For example, when I do this, I use the keyword (?)
"prototype":
It is not a keyword. Javascript''s keywords are defined in ECMA 262 3rd
Ed. Section 7.5. "prototype" is a property name that is emplyed as the
name of a proeprty of function objects that is used when a fucntion is
used as a constructor as the source of the vlaue for the internal
[[Prototype]] property of the constructed object. The internal
[[Prototye]] property of objects is how javascript objects inherit
proerties from other objects.
function Example() {
...
}

Example.prototype.val = undefined;
So, if an object is constructed with:-

var obj = new Example();

- the resulting object does not have a - val - property itself, but it
does inherit one through its internal [[Prototype]] property, which is
assigned its value from the - Example - function''s (public) prototype
property.
What is the relation between that and the "Prototype.js"
library?
The name of the "Prototype.js" library is arbitrary and has no clear
relationship with the prototype inheritance used in javascript (except
by coincidence).
Is that name just plain confusing
The name certainly is confusing.
or am I just plain confused?
(both ? :)



You may be confused as well ;-)

Richard.


这篇关于原型和Prototype.js之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆