How to create an Array in JavaScript?
-
Var x = new Array(50);
-
Var x = new Array[50];
-
Var x = Array(50);
-
Var x = Array[50];
A
Correct answer
Explanation
In JavaScript, arrays are created using the Array constructor with parentheses: new Array(50). Option B uses square brackets which is incorrect syntax for the constructor. Option C is missing the 'new' keyword. Option D has both errors - missing 'new' and using square brackets. The array literal syntax [50] would also be valid but isn't listed.