In JavaScript, you can write a single-line comment using double forward slashes (//). Anything written after // on the same line will be treated as a comment and will not be executed by the JavaScript engine. Here is an example:
// This is a single-line comment
javascript复制成功复制代码
Single-line comments are useful for adding explanations or notes within the code without affecting the functionality.