View

take property from object

special 2021. 8. 31. 21:28

e.g.

 

const obj = {
	name: 'obj',
    prop: 'Hello',
}

이라는 object가 있는 경우

 

const {name} = obj;
console.log(name); // 'obj'

const {property} 로 obj안의 property를 가져올 수 있다.

해당 property이름과 같은 variable을 {}안에 넣어야 한다.

Share Link
reply
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28