What will the following code print to the console?
const fruits = [
{ name: 'apple', price: 2 },
{ name: 'banana', price: 1 }
];
fruits.sort((a, b) => a.price - b.price);
console.log(fruits[1].name);
What will the following code print to the console?
const fruits = [
{ name: 'apple', price: 2 },
{ name: 'banana', price: 1 }
];
fruits.sort((a, b) => a.price - b.price);
console.log(fruits[1].name);