What is the output of the following JavaScript code?
const [x, , ...rest] = [4, 5, 2, 6];
console.log(x, rest[0], rest[1]);- A4 2 6
- B4 5 2
- C5 2 6
- D4 2 undefined
Correct answer: A
What is the output of the following JavaScript code?
const [x, , ...rest] = [4, 5, 2, 6];
console.log(x, rest[0], rest[1]);