카테고리 없음
2023.03.22 웹응용프로그래밍
OnejinSim
2023. 3. 22. 17:53
//quiz1.js
class box {
name = box;
constructor(lenght, width){
this.lenght = lenght;
this.width = width;
this.calculateArea(lenght.width);//이거 아님 제거하셈
}
calculateArea(lenght, width){
return this.lenght * this.width;
}
}
var box = new box(2,2);
box.calculateArea();
//내꺼
//quiz2.js
var options = {
title: "menu",
height: 200,
width: 100,
};
var { title,
...rest
} = options;
console.log(title);
console.log(rest.height);
console.log(rest.width);
console.log(options.height);
//quiz3.js
let options = {
size: {
width: 100,
height: 200,
},
items: ["Cake", "Donut"],
extra: true,
};
var {
title = "menu",
size: {
//속성값, 변수 x
width,
height,
},
items: [item1, itwm2],
} = options;
console.log(title);
console.log(width);
console.log(options.size.width);
console.log(height);
console.log(item1);
console.log(itwm2);
//quiz4.js
let options = {
title: "My menu",
items: ["Item1", "Item2"]
};
// let {
// title,
// width = 200,
// height = 100,
// items
// } = options;
function showMenu({title, width = 200, height = 100, items}){
console.log(`${title} ${width} ${height}`); //My menu 200 100
console.log(items); //Item1, Item2
}
showMenu(options);
배열함수
forEach,
map, reduce (자주쓰게 될것)
의존성 관리
구조분해