Javascript getters and setters - recursion issue

前端 未结 2 1279
不知归路
不知归路 2020-12-06 12:12

Can someone please help me understand the significance of the \'_\' character in the setters and getters of javascript. For example I have the following code which works fi

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 13:11

    It's naming convention used to identify private variables or properties. The _ has no sign particular significance to JS.

    From Airbnb JavaScript style guide:

    Use a leading underscore _ when naming private properties.

    https://github.com/airbnb/javascript#22.4

提交回复
热议问题