Multiple choice technology

What is the correct JavaScript syntax for opening a new window called "w2" ?

  1. w2=window.open("http://www.w3schools.com");

  2. w2=window.open "http://www.w3schools.com";

  3. w2=window.new "http://www.w3schools.com";

  4. w2=window.new("http://www.w3schools.com");

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

The correct syntax to open a new window in JavaScript uses the window.open() method with parentheses. Option A shows w2=window.open("http://www.w3schools.com"); which is correct. Option B is missing parentheses, and options C and D use the non-existent window.new() method.