Multiple choice technology web technology

What is the correct JavaScript syntax to write "Hello World"?

  1. Hello World"

  2. document.write("Hello World")

  3. response.write("Hello World")

  4. ("Hello World")

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

document.write() is the correct JavaScript method to output text content to the HTML document. Option A is incomplete with a syntax error (missing opening quote), Option C uses ASP syntax (response.write), and Option D is just a string in parentheses without any command.