Multiple choice technology architecture

How to create an Array in JavaScript?

  1. Var x = new Array(50);

  2. Var x = new Array[50];

  3. Var x = Array(50);

  4. Var x = Array[50];

Reveal answer Fill a bubble to check yourself
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.