-
For the below mentioned code snippet:
var obj = new Object();
The equivalent statement is:
-
- Object obj=new Object();
- var obj= new Object;
- var obj;
- var obj = Object();
- None of these
Correct Option: B
As a special case, for the new operator only, JavaScript simplifies the grammar by allowing the parenthesis to be omitted if there are no arguments in the function call. Hence you can always omit a pair of empty parentheses in a constructor invocation.