Medium
Complete the missing code to transform an array of user records into a structured report:
1const users = [2 { id: 1, name: 'Alice', purchases: [100, 200, 300], status: 'active' },3 { id: 2, name: 'Bob', purchases: [150, 50], status: 'inactive' },4 { id: 3, name: 'Charlie', purchases: [400, 600, 100], status: 'active' }5];67function generateUserReport(users) {8 return users9 ._____________________10 ._____________________11 ._____________________12}1314const result = generateUserReport(users);15// Should output: { activeUsers: 2, totalSpent: 1900, averageSpent: 316.67 }