How do you write "Hello World" in an alert box?
-
msgBox("Hello World")
-
alertBox="Hello World"
-
alertBox("Hello World")
-
alert("Hello World")
D
Correct answer
Explanation
The alert() function is the correct JavaScript method for displaying an alert box with a message. Options A, B, and C use non-existent functions (msgBox, alertBox) that are not part of JavaScript.