JavaScript is a class-less language. That's not to mean it is less fashionable or more blue-collar than other computer languages; class-less means it doesn't have a class structure in the same way that object-oriented languages do. Instead, it uses prototypes for inheritance.
Although this may be baffling to programmers with backgrounds in C++ and Java, prototype-based inheritance can be much more expressive than traditional inheritance. The following is a brief comparison between the differences between C++ and JavaScript:
| C++ | JavaScript |
|---|---|
| Strongly typed | Loosely typed |
| Static | Dynamic |
| Class-based | Prototype-based |
| Classes | Functions |
| Constructors | Functions |
| Methods | Functions |