Dev-/java script, jQuery, Ajax
자바스크립트 내부 객체를 변수에 할당
thiago6
2019. 8. 29. 14:37
아래가 헷갈렸다.
const obj = {
innerObj: {name: 11111}
};
let copyInnerObj = obj.innerObj;
obj.innerObj = {key: 'key'}; /** --> 여기서 새로운 객체 {key: 'key'}를 만들고 그 주소를 할당함 */
console.log(obj.innerObj); /** {key: 'key'} */
console.log(copyInnerObj); /** {} */