6.
Which of the following options correctly initializes an array in JavaScript?
let myArray = [1, 2, 3];
let myArray = {1, 2, 3};
let myArray = (1, 2, 3);
let myArray = "1, 2, 3";
Correct: A
In JavaScript, arrays are initialized using square brackets []. The elements of the array are separated by commas, and can be of any data type. Therefore, let myArray = [1, 2, 3]; is the correct way to initialize an array with the values 1, 2, and 3. Option A2 is incorrect because it uses curly braces {} instead of square brackets. Option A3 is incorrect because it uses parentheses () instead of brackets. Option A4 is incorrect because it initializes the array with a single string, rather than individual elements.