Comments allow us to explain our code, provide context, and make notes about its functionality or purpose. They can also be used to temporarily disable certain parts of our code during testing or debugging.
Single-line comments: Single-line comments are denoted by double slashes (
Single-line comments are perfect for adding quick explanations or clarifications to specific lines of code.
Multi-line comments: Multi-line comments, also known as block comments, allow us to comment out multiple lines of code or write longer explanations. They are enclosed between
Multi-line comments are useful when writing detailed explanations, documenting functions or classes, or temporarily disabling a block of code.
Add a single-line comment just above the existing console.log statement, explaining what it does.
Sign up to start coding
Already have an account?