Medium
Calculate Total Revenue from Orders Containing Laptop Items in JavaScript Array
You want to calculate the total revenue generated by all orders containing at least one item named "Laptop." Which of the following implementations correctly computes the total revenue?
1const orders = [2 { id: 1, items: [{ name: 'Laptop', price: 1000 }, { name: 'Mouse', price: 50 }] },3 { id: 2, items: [{ name: 'Monitor', price: 300 }, { name: 'Keyboard', price: 100 }] },4 { id: 3, items: [{ name: 'Laptop', price: 1200 }, { name: 'Headphones', price: 200 }] }5];