diff --git a/1_solution.js b/1_solution.js index 2d1ddc3..2b2255c 100644 --- a/1_solution.js +++ b/1_solution.js @@ -4,7 +4,7 @@ let name = "신석"; // ? 부분에 예측 값을 작성해주세요(코드 실행 금지) -alert(`hello ${1}`); // ? -alert(`hello ${"name"}`); // ? -alert("hello ${name}"); // ? -alert(`hello ${name}`); // ? \ No newline at end of file +alert(`hello ${1}`); // hello 1 +alert(`hello ${"name"}`); // hello name +alert("hello ${name}"); // hello ${name} +alert(`hello ${name}`); // hello 신석 \ No newline at end of file diff --git a/2_solution.js b/2_solution.js index e5b5e37..874db54 100644 --- a/2_solution.js +++ b/2_solution.js @@ -6,6 +6,7 @@ let user = { }; // 여기에 코드를 작성해주세요 +const {name: Name, years: age, isAdmin=false} = user; alert(Name); // "민서" alert(age); // 21 diff --git a/3_solution.js b/3_solution.js index 60fba3a..da46797 100644 --- a/3_solution.js +++ b/3_solution.js @@ -4,5 +4,14 @@ let user = { name: "다솜", part: "FE", }; + +const json = JSON.stringify(user); +const parsed = JSON.parse(json); + +console.log(typeof json); +console.log(json); + +console.log(typeof parsed); +console.log(parsed); //답 작성 \ No newline at end of file diff --git a/4_solution.js b/4_solution.js index dd39a09..964b56d 100644 --- a/4_solution.js +++ b/4_solution.js @@ -9,4 +9,9 @@ class Person { getPerson() { console.log(`이름: ${this.name}, 취미: ${this.hobby}`); } -} \ No newline at end of file + + +} + +const yewon= new Person("예원","넷플릭스로 미드보기"); +yewon.getPerson(); \ No newline at end of file diff --git a/5_solution.js b/5_solution.js index 91cb066..270d008 100644 --- a/5_solution.js +++ b/5_solution.js @@ -1,3 +1,6 @@ //5번 문제 -const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const filtered = numbers.filter(numbers => numbers%2==0); +console.log(filtered) \ No newline at end of file diff --git a/6_solution.js b/6_solution.js index 77db40a..444f731 100644 --- a/6_solution.js +++ b/6_solution.js @@ -4,4 +4,19 @@ let arr = [ { part: "fe", name: "보연", age: 21 }, { part: "staff", name: "수빈", age: 24 }, { part: "be", name: "기현", age: 25 } - ]; \ No newline at end of file + ]; + + const filtered = arr.filter(arr1=> arr1.part !== "staff" ); + + const filtered2 = filtered.filter(arr1=>arr1.name !=="보연"); + filtered2.sort((a,b)=>b.age-a.age); + + const newArray = filtered2.map(function(person){ + return person.name; + }); + + console.log("최종 이름 배열: ") + console.log(newArray); + newArray.forEach(function(name){ + console.log(name); + });