From 2b9735a4e6d132ac66e1ccac7ed3b4666fcf04f3 Mon Sep 17 00:00:00 2001 From: june Date: Mon, 31 Mar 2025 19:40:14 +0900 Subject: [PATCH 1/3] p2 --- prob2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prob2.js b/prob2.js index 43114a4..71ad218 100644 --- a/prob2.js +++ b/prob2.js @@ -1,6 +1,9 @@ //2. map활용 문제 const numbers = [1, 2, 3, 4, 5]; -let answer; +let answer = numbers.map(function(element){ + if(element%2==0){return "짝수";} + else{return "홀수";} +}); console.log(answer); From 1bd94d1983393fefe974fcbb894eed2f91a8d9c0 Mon Sep 17 00:00:00 2001 From: june Date: Mon, 31 Mar 2025 19:56:40 +0900 Subject: [PATCH 2/3] p3 --- prob3.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/prob3.js b/prob3.js index b1eacf7..640195f 100644 --- a/prob3.js +++ b/prob3.js @@ -4,16 +4,36 @@ let likelion = [ { name: "전수빈", part: "FE_기획", age: 25 }, { name: "김예린", part: "FE_홍보", age: 23 }, ]; - +let len = likelion.length; +let n = 0; // 1번 문제 코드작성 - +while(nlikelion[i].age){ + likelion[i-1] = likelion[i]; + likelion[i]=tmp; + } + } + n++; +} + console.log(likelion); // 2번 문제 코드작성 let result2 = []; +for(i=0; i=24){ + result2.push(likelion[i]); + } +} console.log(result2); // 3번 문제 코드작성 let targetName = "전수빈"; let result3 = null; - +for(i=0;i Date: Mon, 31 Mar 2025 20:02:17 +0900 Subject: [PATCH 3/3] p1 --- prob1.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prob1.js b/prob1.js index 2eed222..8f0588c 100644 --- a/prob1.js +++ b/prob1.js @@ -2,6 +2,12 @@ function solution(num, total) { let answer = []; + let mid = total/num; + let start = mid-(num-1)/2 + for(let i =0; i