Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions 1_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let name = "신석";

// ? 부분에 예측 값을 작성해주세요(코드 실행 금지)

alert(`hello ${1}`); // ?
alert(`hello ${"name"}`); // ?
alert("hello ${name}"); // ?
alert(`hello ${name}`); // ?
alert(`hello ${1}`); // hello 1
alert(`hello ${"name"}`); // hello name
alert("hello ${name}"); // hello ${name}
alert(`hello ${name}`); // hello 신석
1 change: 1 addition & 0 deletions 2_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let user = {
};

// 여기에 코드를 작성해주세요
const {name: Name, years: age, isAdmin} = user; // 객체 구조분해 할당 이용

alert(Name); // "민서"
alert(age); // 21
Expand Down
9 changes: 8 additions & 1 deletion 3_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ let user = {
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);
5 changes: 4 additions & 1 deletion 4_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ class Person {
getPerson() {
console.log(`이름: ${this.name}, 취미: ${this.hobby}`);
}
}
}

const lby = new Person("임병윤", "축구"); // new로 새로운 객체 생성
lby.getPerson();
5 changes: 4 additions & 1 deletion 5_solution.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//5번 문제

const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

const filtered = numbers.filter(numbers => numbers % 2 == 0); // filter 함수 사용
console.log(filtered);
13 changes: 12 additions & 1 deletion 6_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@ let arr = [
{ part: "fe", name: "보연", age: 21 },
{ part: "staff", name: "수빈", age: 24 },
{ part: "be", name: "기현", age: 25 }
];
];

const arr1 = arr.filter(arr => arr.part != "staff"); // staff 제거

const arr2 = arr1.filter(arr1 => arr1.name != "보연"); // 보연 제거

arr2.sort((a, b) => b.age - a.age); // 나이 내림차순 정렬

let arr3 = arr2.map(members => members.name)
console.log(arr3); // 이름만 뽑아 배열 만들기

arr3.forEach(name => console.log(name)); // 한줄씩 출력