Title: JavaScript Comments: Single-Line, Multi-Line & JSDoc | PlayCode
Open Graph Title: JavaScript Comments: Single-Line, Multi-Line & JSDoc | PlayCode
Description: Learn how to write comments in JavaScript. Master single-line (//) and multi-line (/* */) comments, plus JSDoc for documentation. Best practices included.
Open Graph Description: Learn how to write comments in JavaScript. Master single-line (//) and multi-line (/* */) comments, plus JSDoc for documentation. Best practices included.
Keywords:
Opengraph URL: https://playcode.io/javascript/comments
Domain: playcode.io
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"How do you write a single-line comment in JavaScript?","acceptedAnswer":{"@type":"Answer","text":"Use two forward slashes (//) followed by your comment text. Everything after // on that line is ignored by JavaScript. Example: // This is a comment"}},{"@type":"Question","name":"How do you write a multi-line comment in JavaScript?","acceptedAnswer":{"@type":"Answer","text":"Use /* to start and */ to end a multi-line comment. Everything between these markers is ignored. Example: /* This is a multi-line comment */"}},{"@type":"Question","name":"What is JSDoc in JavaScript?","acceptedAnswer":{"@type":"Answer","text":"JSDoc is a documentation standard using special comment syntax (/** */). It describes functions, parameters, return types, and more. IDEs use JSDoc for autocomplete and type hints."}},{"@type":"Question","name":"Should I comment my code?","acceptedAnswer":{"@type":"Answer","text":"Comment the \"why\", not the \"what\". Good code is self-documenting for what it does. Use comments to explain why a particular approach was chosen, document APIs with JSDoc, and mark TODOs."}}]}
| None | IE=edge,chrome=1 |
| apple-mobile-web-app-capable | yes |
| apple-mobile-web-app-status-bar-style | black-translucent |
| theme-color | #061b33 |
| google-site-verification | 3e1cNRYuUBDvzPJ9VerwCKlrqiCwBDo_3DefS4u__3o |
| author | PlayCode |
| renderer | browser |
| og:site_name | PlayCode.io |
Links:
Viewport: width=device-width
Robots: noodp, noydir, notranslate