{"id":1840,"date":"2020-05-07T22:47:26","date_gmt":"2020-05-07T22:47:26","guid":{"rendered":"http:\/\/endlesshybrids.com\/?p=1840"},"modified":"2020-05-07T22:47:26","modified_gmt":"2020-05-07T22:47:26","slug":"how-to-write-comments-in-javascript","status":"publish","type":"post","link":"https:\/\/endlesshybrids.com\/coding\/how-to-write-comments-in-javascript\/","title":{"rendered":"How to Write Comments in JavaScript"},"content":{"rendered":"\n
All programming languages have the capability for the programmer to add comments into the code. Comments, unlike the other parts of the code, are intended for humans. Writing good comments are an important part of coding. Comments provide notes on what the code is doing. <\/p>\n\n\n\n
Some professional programmers will say that good programming does not need explanation. But, as a beginner in coding, you should make use of comments.<\/p>\n\n\n\n
Comments on a single line are started with two forward slashes \/\/<\/strong>.<\/p>\n\n\n\n On lines 5 and 7, you can see two different single line comments. Those comments describe the code in the very next line that follows the comment. <\/p>\n\n\n\n The reason you write this type of comment would be for yourself: so that you remember a month later what the code is doing. As you are learning to code, leaving a lot of explanations is a good form of teaching yourself what the code does. Also, comments help others understand your code. As you gain more experience, you will write fewer comments.<\/p>\n\n\n\n Multi-line comments, or block comments, start with the opening tag \/* <\/strong>and end with the closing tag *\/<\/strong><\/p>\n\n\n\n The multi-line comment above comments out, or disables, those lines of code. In most code editors, lines that are comments will be grayed out and not in color. You can use comments in this manner to debug code when you are trying to troubleshoot a problem.<\/p>\n\n\n\n When you are finished coding, either before you turn in an assignment or start using code for production work, go back and delete any unnecessary comments. This will make your code more readable in the long-term.<\/p>\n","protected":false},"excerpt":{"rendered":" All programming languages have the capability for the programmer to add comments into the code. Comments, unlike the other parts of the code, are intended for humans. Writing good comments are an important part of coding. Comments provide notes on what the code is doing. Some professional programmers will say that good programming does not […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[33],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/1840"}],"collection":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/comments?post=1840"}],"version-history":[{"count":11,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/1840\/revisions"}],"predecessor-version":[{"id":1851,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/1840\/revisions\/1851"}],"wp:attachment":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/media?parent=1840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/categories?post=1840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/tags?post=1840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}function pageTransition () {\n var tl = gsap.timeline();\n\n tl.set('.loading-screen', {transformOrigin: \"bottom left\"});\n \/\/raises div to the top of the screen, horizontally\n tl.to('.loading-screen', { duration: .5, scaleY: 1});\n \/\/moves div off top of screen\n tl.to('.loading-screen', { duration: .5, scaleY: 0, skewX: 0,\n transformOrigin: \"top left\", ease: \"power1.out\", delay: 1});\n}<\/code><\/pre>\n\n\n\n
function pageTransition () {\n var tl = gsap.timeline();\n\n tl.set('.loading-screen', {transformOrigin: \"bottom left\"});\n \/*\n tl.to('.loading-screen', { duration: .5, scaleY: 1});\n tl.to('.loading-screen', { duration: .5, scaleY: 0, skewX: 0,\n transformOrigin: \"top left\", ease: \"power1.out\", delay: 1});\n*\/\n}<\/code><\/pre>\n\n\n\n
Cleaning up comments<\/h2>\n\n\n\n