We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
배열에서 투자금이 5000 이상인 투자자들을 찾고, 나이대별로 그룹화하여 이름과 수익을 보여주세요
// investment 투자금 // returnRate 수익률 // 수익: 투자금 * 수익률 const investors = [ { name: "John", age: 35, investment: 5000, returnRate: 0.15 }, { name: "Alice", age: 42, investment: 8000, returnRate: 0.12 }, { name: "Bob", age: 28, investment: 3000, returnRate: 0.18 }, { name: "Carol", age: 55, investment: 10000, returnRate: 0.13 }, { name: "David", age: 47, investment: 6000, returnRate: 0.11 }, { name: "Eve", age: 31, investment: 7000, returnRate: 0.16 }, { name: "Frank", age: 39, investment: 9000, returnRate: 0.19 }, { name: "Grace", age: 44, investment: 12000, returnRate: 0.14 }, { name: "Henry", age: 52, investment: 1000, returnRate: 0.17 }, { name: "Ivy", age: 36, investment: 4000, returnRate: 0.10 }, { name: "Jane", age: 28, investment: 2000, returnRate: 0.15 }, { name: "Kate", age: 29, investment: 3000, returnRate: 0.12 }, { name: "Luke", age: 26, investment: 4000, returnRate: 0.18 }, { name: "Mark", age: 27, investment: 2500, returnRate: 0.13 }, { name: "Nancy", age: 25, investment: 1500, returnRate: 0.11 } ]; // 나이대 별 그룹화 함수 function getAgeRange(age) { if (age >= 20 && age < 30) { return "20s"; } else if (age >= 30 && age < 40) { return "30s"; } else if (age >= 40 && age < 50) { return "40s"; } else if (age >= 50 && age < 60) { return "50s"; } else { return "Unknown"; } }
조건
{ '30s': [ { name: 'John', age: 35, investment: 5000, returnRate: 0.15, profit: 750 }, { name: 'Eve', age: 31, investment: 7000, returnRate: 0.16, profit: 1120 }, { name: 'Frank', age: 39, investment: 9000, returnRate: 0.19, profit: 1710 } ], '40s': [ { name: 'Alice', age: 42, investment: 8000, returnRate: 0.12, profit: 960 }, { name: 'David', age: 47, investment: 6000, returnRate: 0.11, profit: 660 }, { name: 'Grace', age: 44, investment: 12000, returnRate: 0.14, profit: 1680.0000000000002 } ], '50s': [ { name: 'Carol', age: 55, investment: 10000, returnRate: 0.13, profit: 1300 } ] }
주문 기록을 토대로 총 주문의 총 금액을 계산하여 반환하세요.
// orders : 주문 배열 // products: 상품 배열 // productId: 상품 번호 // price: 상품 금액 // 주문 금액: quantity * price const orders = [ { id: 1, productId: 1, quantity: 2 }, { id: 2, productId: 2, quantity: 1 }, { id: 3, productId: 3, quantity: 5 }, { id: 4, productId: 2, quantity: 3 }, { id: 5, productId: 1, quantity: 4 }, { id: 6, productId: 3, quantity: 2 }, { id: 7, productId: 4, quantity: 1 }, { id: 8, productId: 2, quantity: 2 }, { id: 9, productId: 3, quantity: 3 }, { id: 10, productId: 1, quantity: 1 } ]; const products = [ { id: 1, name: 'Apple', price: 1000 }, { id: 2, name: 'Banana', price: 500 }, { id: 3, name: 'Orange', price: 800 }, { id: 4, name: 'Grapes', price: 1500 } ];
출력값
8500
hint: find() 함수 products.find(product => product.id === order.productId)
The text was updated successfully, but these errors were encountered:
0715 함수형 스터디 문제 구현 repo: elegant-functional-2023/elegant-function-202…
120a0f2
…3#10
sa02045
No branches or pull requests
문제 1
조건
원하는 출력값
문제2
출력값
The text was updated successfully, but these errors were encountered: