Hasty Briefsbeta

双语

Writing good comments: the why, not the how (2020)

a year ago
  • #Code Comments
  • #JavaScript
  • #Best Practices
  • 代码通过 `'' + maybeKey` 将可能未定义的 `maybeKey` 转换为字符串。
  • 注释解释了问题所在,提供了示例,并概述了短期和长期的解决方案。
  • 注释应着重解释代码背后的'原因',而不仅仅是'做了什么',以便为后续开发人员提供上下文。