This was one of the confusing questions on which I spent a lot of time googling and discussing or rather arguing with my friends. And finally the I could reach a convincing solution which is as follows:
“Prototype-based programming is a style of object-oriented programming in which classes are not present, and behavior reuse (known as inheritance in class-based languages) is accomplished through a process of decorating existing objects which serve as prototypes. This model is also known as class-less, prototype-oriented, or instance-based programming.”
Which means unlike other languages (eg java ,c++) it does not have “Classes”. But it uses functions as classes. In other words defining a class is as simple as writing a function. For instance,
this.name = “lion”;
Whenever we create a new object using “new”, this method is invoked. So this function can be treated a constructor. For those who insists on classes, this function can be considered as class as well. As convention, Constructor name always start with capital letter.
Eg: var lion = new Animal();