How to Create a Single Line Comment in JavaScript ?
In JavaScript, you can create a single-line comment using the //
double forward slash. Everything following //
that line will be treated as a comment and will not be executed.
Example: the lines starting with //
are single-line comments. They are ignored by the JavaScript interpreter and are purely for the benefit of developers to add explanations or notes in the code.
// This is a single-line comment
let x = 5; // You can also add a comment at the end of a line of code