1. Single-line Comments:
// This is a single-line comment
let variable = 42; // Assigning a value to the variable
2. Multi-line Comments:
Multi-line comments, enclosed between /* and */, are used for longer explanations or for commenting out multiple lines of code. While they serve a similar purpose to single-line comments, multi-line comments are ideal for providing context to larger sections of code.
This is a multi-line comment
It spans multiple lines for detailed explanations
let result = performComplexCalculation();