Q. What will be logged?
Code:
let arr = [1, 2, 3]; arr.length = 1; console.log(arr);
β
Correct Answer: (A)
[1]
Explanation: Setting length to 1 truncates the array to one element.