1.2k views
5 votes
What is the correct JavaScript syntax for opening a new window called "w2"?

a) w2 = (" ");
b) w2 = (" ");
c) window.open("w2", "_blank");
d) openWindow("w2");

2 Answers

3 votes

answer:

d)

Step-by-step explanation:

openwindow("w2")

User Jjlin
by
8.1k points
4 votes

Final answer:

The correct JavaScript syntax to open a new window is 'window.open("w2", "_blank");', where 'w2' would be replaced with the URL you wish to open in the new window or tab.

Step-by-step explanation:

The correct JavaScript syntax for opening a new window called "w2" is option c, which is window.open("w2", "_blank");. When this line of JavaScript is executed, it will open a new browser window or tab depending on the user's browser settings and the parameters passed to window.open. The first argument is the URL you want to open, which can be an actual path or left empty (e.g., "") for a blank page. The second argument, "_blank", specifies that the URL should be opened in a new window or tab.

User Irfan
by
8.6k points