+ 2
Does javascript support data encapsulation, polymorphism as other objetct oriented programming language
2 odpowiedzi
+ 2
Yes, support something like oop. Does not have classes with methods, but you can simulate it by functions.
+ 2
It depends on the version. In versions of Ecmascript (padrão JavaScript) below 6 you can simulate OOP with objects, functions and the prototype pattern.
In Ecmascript 6 we have new features that support OOP, mainly classes.
Many browsers don't support Ecmascript 6 yet, and that's why people continue using legacy code. But you can use Babel for translating this new version of JavaScript code to legacy code, in your projects.
Read more:
Babel:
https://babeljs.io
Classes (Ecmascript 6):
http://es6-features.org/#ClassDefinition