To write "Hello World" in JavaScript, the correct syntax is:
B. document.write("Hello World")
Explanation:
A. response.write("Hello World"): This is not the correct syntax. The "response" object does not have a "write" method in JavaScript.
B. document.write("Hello World"): This is the correct syntax. The "document" object represents the current web page, and the "write" method is used to write content directly to the web page. In this case, it will write "Hello World" to the page.
C. ("Hello World"): This is not the correct syntax. Parentheses alone do not have any specific meaning in JavaScript.
D. "Hello World": This is a string literal and is valid syntax in JavaScript. However, it does not actually write "Hello World" to the web page. It is just a static string value that can be assigned to a variable or used in other operations.
Therefore, the correct answer is B. document.write("Hello World").