Web Tools Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu February 12, 2023 › #Javascript #Q&A

Which of the following is the correct statement for comment in a JavaScript?

  1. A) $This is a comment$
  2. B) //This is a comment
  3. C) #This is a comment#
  4. D) None of above

Answer: B) //This is a comment.

Explanation: In JavaScript, comments are denoted by //. This indicates that the text following the // is a comment and will not be executed by the browser. Comments are useful for providing explanations.

Example:

<script>
  console.log("Hello World!"); // output - Hello World
</script>
save
listen
AI Answer
Write Your Answer
loading
back
View All