What exactly Javascript prototype is? A library or something builtin
Javascript?
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.
No comments:
Post a Comment