// line comment and /* block comment */ are ignored at runtime. JSDoc (/** … */ with @param/@returns) documents functions and powers editor tooltips and type hints. Comment the why, not the obvious what.
// line comment and /* block comment */ are ignored at runtime. JSDoc (/** … */ with @param/@returns) documents functions and powers editor tooltips and type hints. Comment the why, not the obvious what.
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>/** double a number @param {number} n @returns {number} */
function double(n){ return n*2; } // why: shared helper
document.getElementById('o').textContent = double(21);</script></body></html>▶ Open the interactive comic issue