0

JavaScript classes (or lack thereof)

So I have read that JavaScript is a language that uses no classes. i was wondering. Does the object constructor act in the same way? making a template to base other objects on?

12th Oct 2018, 2:35 PM
DazVonHelmet
DazVonHelmet - avatar
1 Odpowiedź
+ 2
Javascript has a system of prototypes to do inheritance-related tasks. In a sense of speaking, constructors in JS have the same purpose as those in class-based language, but it's core aspects are totally different and will take a while to explain. ES6 supports classes with a syntax similar to other OOP languages. Behind the scene, they're still the prototypal inheritance that previous ES versions used.
12th Oct 2018, 3:11 PM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar