To be fair, JavaScript has classes. Well, maybe some argue with that, but I think it's just semantic hair splitting. If the class is considered a blue font for creating objects, then the JavaScript function can serve as that. There is not much difference in function, only the form:
class someObj { private int x; public int returnX() { return x; } } someObj temp = new someObj();
-
function someObj { var x; this.returnX = function() { return x; }; } var temp = new someObj();
They are different under the hood, but you can use any form to serve the same end.
Prototype really differs in inheritance. In prototypical inheritance, when you create a new object, you really copy an instance of the prototype object, and then add new fields or members to it. On the other hand, classical inheritance does not deal with an instance, but simply a βblue printβ. For example, in JavaScript, you would say:
temp.prototype = new someOtherObj();
In classic language you can say:
class someObj : someOtherObj
The implication is that data will be transferred between derived objects in the prototype language. I once wrote a function and got another function from it using prototyping in JavaScript. This base object contained a reference to the DOM object, and when I changed it in one child object, it would change it for all instances of this child object. This is because, again, in the prototype language, you are creating an instance, not a βblue printβ.