3.
Which of the following is a valid way to declare and initialize an array with elements in JavaScript?
var myArray = [1, 2, 3];
var myArray = new Array(1, 2, 3);
var myArray = {1, 2, 3};
var myArray = array(1, 2, 3);
Correct: A, B
A1 and A2 are both valid ways to declare and initialize an array with elements. A3 is incorrect syntax as it creates an object literal, not an array. A4 is not a valid JavaScript syntax to declare an array with elements.