Explanation of the prototype object

Another important concept that we need to discuss before getting into coding our blockchain data structure is the prototype object. The prototype object is simply an object that multiple other objects can refer to in order to get any information or functionality that they need. For our example, which we discussed in the previous section, each of our constructor functions will have a prototype that all of their instances will be able to refer to. Let's try to understand what a prototype object means by exploring a couple of examples.

For example, if we take our User constructor function that we created in the previous section, we can put those properties onto its prototype. Then, all of our user instances ...

Get Learn Blockchain Programming with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.