Naming convention for const object keys in ES6

前端 未结 4 1054
情话喂你
情话喂你 2021-01-31 08:03

Is there a recommended naming convention for key names within a const object in es6? I haven\'t been able to find a resource which states if they should be uppercase or lowercas

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 08:41

    According to Google it would be all caps. Speaking from experience, most of the other programming languages have all caps so I would suggest using that.

    Use NAMES_LIKE_THIS for constant values.

    Use @const to indicate a constant (non-overwritable) pointer (a variable or property).

    Google javascript guide https://google.github.io/styleguide/javascriptguide.xml

提交回复
热议问题