How do you write "Hello World" in an alert box?
-
msgBox("Hello World")
-
alertBox("Hello World")
-
alert("Hello World")
-
alertBox="Hello World"
C
Correct answer
Explanation
alert() is the built-in JavaScript function that displays a modal dialog box with a message and an OK button. Option A uses msgBox() which doesn't exist in standard JavaScript, option B uses alertBox() which is also not a standard function, and option D attempts to assign a string to a non-existent alertBox property.