25.
What will be the output of the following code?
const cars = ["Toyota", "Honda", "Nissan"];
cars.pop();
console.log(cars);
["Toyota", "Nissan"]
["Honda", "Nissan"]
["Toyota", "Honda", "Nissan"]
["Toyota", "Honda"]
Correct: D
The pop() method removes the last element from an array and returns that element. In this code, the pop() method is called on the cars array, which removes the last element Nissan. Therefore, after the pop() method, the array will become ["Toyota", "Honda"]. Finally, the console.log() method prints the updated array.