목록html (1)
바르고 뜨겁게
[자바스크립트] 오브젝트에서 변수 꺼내기 (비구조화 할당 Object Destructuring)
오브젝트에서 변수꺼내기 (비구조화 할당 Object Destructuring)1. 변수명 변경해서 꺼내기2. 오브젝트 변수명으로 받3. 배열 형태로 꺼내기 const obj = { depth1_0: "1단계 0", depth1_1: "1단계 1", depth1_2: { depth2_0: "2단계 0", depth2_1: "2단계 1" } } // 기존방식 const oldDepth1 = obj.depth1_0; const oldDepth2 = obj.depth1_2.depth2_0; console.log(`기존방식 oldDepth1: ${oldDepth1} / oldDepth2: ${oldDepth2}`); // (비구조화 할당 Object Destructuring) // 변수명변경 , 그대로..
자바스크립트/Vanilla Js
2019. 5. 17. 01:26