Pseudoclassical Instantation

First of all, what is instantiation? Instantiation is a way to make objects and methods. There are several instantation patterns but generally when people talk about instantiation patterns they usually talk about these 4:
- functional
- functional-shared
- prototypal
- pseudoclassical
Out of these 4 instantiation patterns, pseudoclassical is the most recommended. Pseudoclassical instantiation is a little cleaner and less code to write and because of this it is the recommended pattern to use. Some key componants for pseudoclassical insantiation is the key words “this”, “new” and “prototype”. Lets look at some code:
Var Cats = function(name, , food){
this.name = name;
this.color = color;
this.food = food;
}
Cats.prototype.eatFood = function(){
Return `I’m a cat and I eat ${this.food}`
};
var pickles = new Cats(‘Pickles’, ‘Siamese’, ‘Pizza’);
pickles.eatFood(); // ‘I’m a cat and I eat Pizza’