How can using prototype be useful in javascript?

I regularly see people make make use of of antecedent in their Javascript formula though we nonetheless assimilate how it’s useful. Can someone here insist to me because we should make make use of of antecedent in my Javascript code?

One thought on “How can using prototype be useful in javascript?

  1. On the assumption that you don’t mean Prototype the javascript framework (frameworks save you time in implementing common functionality).

    prototype really helps when defining a class layout in javascript

    for example:

    I could have

    HelloPrinter = function(message) {
    ….this.message = message;
    };

    HelloPrinter.prototype.printHello = function() {
    alert("Hello " + this.message);
    };

    var x = new HelloPrinter("World");
    var y = new HelloPrinter("Earth");

    x.printHello();
    y.printHello();