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 신석석
3 changes: 2 additions & 1 deletion 2_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ let user = {
years: 21,
};

// 여기에 코드를 작성해주세요
// cosnt {name : Name, years : age, is : isAdmin = false} = user;


alert(Name); // "민서"
alert(age); // 21
Expand Down
3 changes: 2 additions & 1 deletion 3_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ let user = {
part: "FE",
};

//답 작성

let js = JSON.stringify(user); const parsed = JSON.parse(js); 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}`);
}
}
}

let tmp = new Person("박준희","낮잠");
tmp.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 evens = numbers.filter(n =>(n%2==0) );
console.log(evens);
32 changes: 16 additions & 16 deletions 6_solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ let arr = [
{ part: "be", name: "기현", age: 25 }
];

// 1. staff 제거
arr = arr.filter(member => member.part !== "staff");
// 2. "fe"남기되 "보연"은 제거
arr = arr.filter(member => !(member.part === "fe" && member.name === "보연"));
// 3. 나이 내림차순 정렬
arr.sort((a, b) => b.age - a.age);
// 4. 이름만 뽑아 배열 만들기
const names = arr.map(member => member.name);
console.log("최종 이름 배열:", names);
// 5. 이름 한 줄씩 출력
names.forEach(name => console.log(name));
//1. "staff"인 멤버는 제외합니다
let tmp = arr.filter(n => (n.part!="staff"));
console.log(tmp);
//2. "fe" 파트는 남기되, "보연"이라는 이름은 제외
let tmp2 = tmp.filter(n => n.name!="보연");
console.log(tmp2);
//3. 남은 멤버들을 나이(age) 내림차순으로 정렬
tmp2.sort((a,b)=> b.age-a.age);
console.log(tmp2);
//4. 이름만 뽑아서 새 배열에 저장합니다.
let tmp4 = tmp2.map(n => (n.name));
console.log(tmp4);
//(map) 5. 이름 배열을 forEach()를 사용해 한 줄씩 출력해보세요
tmp4.forEach((v,i)=>{
console.log(`${v}`);
});