How do you define an OOP class in JavaScript?

2019-02-22 06:12发布

Based on my observation, the book that I am reading about JavaScript states that there's an OOP with JavaScript? It doesn't tell much about it, I mean it wasn't explained how to define a class. Can someone give me a sample snippet?

Thanks

7条回答
Anthone
2楼-- · 2019-02-22 06:43

In JavaScript everything is a object. So even a function is a object. So in js (less then < version 2), function makes classes (which are first class objects themselves). Go here, here and herefor understanding better

查看更多
登录 后发表回答