Which of the following will create an array with the specified elements [1, 2, 3]?
new Array(1, 2, 3)
new Array([1, 2, 3])
new Array(3).fill(1, 2, 3)
new Array(3).map((value, index) => index + 1)
The correct options for creating an array with the specified elements [1, 2, 3] are A1: new Array(1, 2, 3) and A2: new Array([1, 2, 3]).
A1 explicitly specifies the elements within the parentheses.
A2 wraps the array literal [1, 2, 3] inside the new Array() constructor.
A3 creates a new array with a length of 3 using new Array(3), but then fills all the elements with the value 1 from index 2 to 3 using .fill().
A4 uses new Array(3) to create a new array of length 3, but then tries to map over the array using .map(), which would result in an array of [undefined, undefined, undefined] since the .map() callback is not returning any values.