{"id":540,"date":"2021-04-01T18:32:11","date_gmt":"2021-04-01T16:32:11","guid":{"rendered":"https:\/\/www.javascripttutorials.net\/?p=540"},"modified":"2021-04-01T18:32:11","modified_gmt":"2021-04-01T16:32:11","slug":"the-art-of-javascript-code-comments","status":"publish","type":"post","link":"https:\/\/www.javascripttutorials.net\/the-art-of-javascript-code-comments\/","title":{"rendered":"The Art of JavaScript Code Comments"},"content":{"rendered":"<p>Commenting JavaScript code is a more nuanced thing than we give it credit for. There are a couple of schools of thought on this. One states that if you feel a comment is necessary, you should rewrite it to be more legible. This is true. But it is also not true.<!--more--> In the process of writing a comment, you can often find things that could be written better, but it is not an either\/or, for the following reason: JavaScript code can describe how, but it cannot explain why. There is just not one right way or one reason to write a comment. This session will dig into some of the many beneficial types of comments that might all serve a different purpose, followed by patterns we might want to avoid. In the process we will talk about being good teammates, collaborating, and writing the most legible JavaScript code we can.<\/p>\n<p><iframe loading=\"lazy\" title=\"The Art of Code Comments - Sarah Drasner | JSConf Hawaii 2020\" width=\"730\" height=\"411\" src=\"https:\/\/www.youtube.com\/embed\/yhF7OmuIILc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Video producer: <a href=\"https:\/\/www.jsconfhi.com\/\">https:\/\/www.jsconfhi.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenting JavaScript code is a more nuanced thing than we give it credit for. There are a couple of schools of thought on this. One states that if you feel a comment is necessary, you should rewrite it to be more legible. This is true. But it is also not &hellip;<\/p>\n","protected":false},"author":1,"featured_media":542,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-540","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/posts\/540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/comments?post=540"}],"version-history":[{"count":0,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/posts\/540\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/media\/542"}],"wp:attachment":[{"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/media?parent=540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/categories?post=540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javascripttutorials.net\/wp-json\/wp\/v2\/tags?post=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}