why class is called as prototype
Answers
Explanation:
Executive summary: The core idea of “prototypes as classes” is that prototypes are better classes than constructor functions. That is, if you have a class C and create instances via new C(), then C should be the prototype of the instances, not their constructor function.
Just like a prototype, a class doesn't have a existence of it's own. It is merely a blueprint declaring certain characteristics and features.
What exists is an object that follows and meets the characteristics and features declared by its class and holds true values to the features.
Eg: A car. It is a class. It doesn't exists of it's own. What exists is Maruti800, WagonR etc, which follow all the features of the car like tyres, seats, steering. It holds value to the features like :
Class :car
Features:
Tyres
Seats
gears.
Object: Maruti800
Values:
4 tyres
5 seats
4 gears.
#sumedhian ❤❤