21.) What is the result of the following code?
const arr = [1, 2, 3];
const [a, ...rest] = arr;
console.log(a, rest);
22.) What is the output of the following code?
const obj = { x: 10, y: 20 };
const { x, z = 30 } = obj;
console.log(x, z);
23.) What will be logged in the following code?
const multiply = (x, y = 2) => x * y;
console.log(multiply(3));
24.) What is the output of the following code?
const square = n => n * n;
console.log([1, 2, 3].map(square));
25.) What is the result of the following code?
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const merged = { ...obj1, ...obj2 };
console.log(merged);