Question 11
Consider the following JavaScript code snippet:
const products = [ { name: 'Laptop', price: 1200, category: 'Electronics', inStock: true }, { name: 'Book', price: 25, category: 'Education', inStock: false }, { name: 'Phone', price: 800, category: 'Electronics', inStock: true }, { name: 'Pen', price: 5, category: 'Stationery', inStock: true }, { name: 'Tablet', price: 600, category: 'Electronics', inStock: false }];
const result = products .filter(item => item.category === 'Electronics' && item.inStock) .map(item => ({ ...item, discountedPrice: item.price * 0.9 })) .filter(item => item.discountedPrice > 500);
console.log(result.length);console.log(result[0].name);What will be the output of the above code on the browser's console?