Underscore prefix for property and method names in JavaScript

后端 未结 6 1731
误落风尘
误落风尘 2020-11-22 16:26

Is the underscore prefix in JavaScript only a convention, like for example in Python private class methods are?

From the 2.7 Python documentation:

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 16:51

    JSDoc 3 allows you to annotate your functions with the @access private (previously the @private tag) which is also useful for broadcasting your intent to other developers - http://usejsdoc.org/tags-access.html

提交回复
热议问题