Reputation: 1919
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.
Upvotes: 2
Views: 4246
Reputation: 780889
It'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.org
Upvotes: 5
Reputation: 302
prototype is a javascript library just like Jquery you need to include it into your html file
Upvotes: 0
Reputation: 39260
For more info on prototype (standard JS not the library) check this answer.
Upvotes: 2