JavaScript OOP in NodeJS: how?

前端 未结 6 1863
野的像风
野的像风 2021-01-29 18:31

I am used to the classical OOP as in Java.

What are the best practices to do OOP in JavaScript using NodeJS?

Each Class is a file with module.export

6条回答
  •  悲&欢浪女
    2021-01-29 18:46

    I suggest to use the inherits helper that comes with the standard util module: http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor

    There is an example of how to use it on the linked page.

提交回复
热议问题