I recently found out that Javascript function can have classes, so I was wondering if OOP is also possible through javascript. Is It? If yes, Could you please point out some tutorials or site, where I can start with?
I recently found out that Javascript function can have classes, so I was wondering
Share
OOP is definitely possible. While Javascript doesn’t have “classes” like most OO languages do, what it does have is called “prototypes”. Basically, objects are defined in terms of other objects rather than classes. (Objects can also emulate classes to some degree, for those who can’t wrap their minds around prototypal inheritance.)
One could argue JS’s OO capabilities exceed those of most languages, considering objects play an even more essential role than in languages with classes.