admin管理员组文章数量:1336415
I am confused between prototype thing. I have researched and watched tutorials but still I have not been able to get a clear answer. Glad if someone could help me under it. Great if using some simple example or explanation.
Is Prototype a library? e.g. Jquery
If Yes. That means we need to add it to our file before working with it. Like we add Jquery in head and then we get access to it's functions and all.
So we need to learn it before using it because prototype is build using the pure javascript like Jquery is.
If Prototype is a Library then how can we access it without even adding to file ?
For example :- When we are writing some javascript code then we automatically get access to Prototype thing like in this code below.
function Apple (type) { this.type = type; this.color = "red"; }
Apple.prototype.getInfo = function() { return this.color + ' ' + this.type + ' apple'; };
Some people are saying Prototype is actually a Javascript.
If this is right then how we have prototype and jQuery separated in this list from JSFiddle below.
Or is Prototype library like in the image above is different than the Javascript prototype object?
Means these are 2 different things.
Could you please clarify my these 4 points.
Thank you.
I am confused between prototype thing. I have researched and watched tutorials but still I have not been able to get a clear answer. Glad if someone could help me under it. Great if using some simple example or explanation.
Is Prototype a library? e.g. Jquery
If Yes. That means we need to add it to our file before working with it. Like we add Jquery in head and then we get access to it's functions and all.
So we need to learn it before using it because prototype is build using the pure javascript like Jquery is.
If Prototype is a Library then how can we access it without even adding to file ?
For example :- When we are writing some javascript code then we automatically get access to Prototype thing like in this code below.
function Apple (type) { this.type = type; this.color = "red"; }
Apple.prototype.getInfo = function() { return this.color + ' ' + this.type + ' apple'; };
Some people are saying Prototype is actually a Javascript.
If this is right then how we have prototype and jQuery separated in this list from JSFiddle below.
Or is Prototype library like in the image above is different than the Javascript prototype object?
Means these are 2 different things.
Could you please clarify my these 4 points.
Thank you.
Share asked Aug 26, 2013 at 23:57 Ricky SharmaRicky Sharma 1,9193 gold badges24 silver badges46 bronze badges 4- 3 There is a JavaScript library called "Prototype". The term "prototype" is also used (both descriptively and as part of the runtime system) for a basic mechanism of the programming language. The uses of the terms are only conceptually related, and loosely at that. You can't get around dealing with the "prototype" concept in JavaScript programming, but you absolutely do not have to use the Prototype library. – Pointy Commented Aug 26, 2013 at 23:59
- ^ i support this ment – Shan Robertson Commented Aug 27, 2013 at 0:00
- @Pointy So that means these are 2 different things like I have mentioned in point 4? – Ricky Sharma Commented Aug 27, 2013 at 0:01
- 1 @RIK yes, point 4 it is. They're two almost pletely different things. The "Prototype" library (probably) takes its name from the fact that it's based on an implementation approach that exploits the "prototype" language construct. – Pointy Commented Aug 27, 2013 at 0:07
3 Answers
Reset to default 5It's both.
Javascript has a standard property of objects named
prototype
, which is used as part of its object-oriented programming mechanism. You can read more about it in this question: How does JavaScript .prototype work?There's a Javascript framework library called Prototype. You can learn more about it at prototypejs
- prototype.js is a library that like jQuery makes is easier to register events, select html elements and such.
- prototype is also part of standard JavaScript, the code you provided is part of standard JavaScript so you don't need the prototype.js library for that code to work.
- Prototype is both a library and standard JavaScript (see answer 1 and 2)
- See previous answers
For more info on prototype (standard JS not the library) check this answer.
prototype is a javascript library just like Jquery you need to include it into your html file
版权声明:本文标题:prototypejs - What exactly Javascript prototype is? A library or something builtin Javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742405100a2468659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论