Deep Dive 11장. 원시 값과 객체의 비교 (p.150)
// 얕은 복사
const c1 = o;
console.log(c1 === o); // true
console.log(c1.x === o.x); // true
const c2 = { ...o };
console.log(c2 === o); // false
console.log(c2.x === o.x); // true
// 깊은 복사
const _ = require("lodash"); // npm install lodash
const c3 = _.cloneDeep(o);
console.log(c3 === o); // false
console.log(c3.x === o.x); // false
(내가 이해한 얕은 복사와 깊은 복사)
FIN.
[JS] 상속 과정은 두 가지 레벨에서 일어난다. (0) | 2025.06.07 |
---|---|
[JS] 함수 선언문은 '표현식인 문'인가? (0) | 2025.04.09 |
MyBatis Mapper 파일 위치: IntelliJ와 Eclipse의 차이 (0) | 2025.02.02 |
Spring Boot JSP "Error resolving template" 오류 해결하기 (2) | 2025.02.01 |
Spring Boot에서 CSS 파일 로드 오류 해결하기 (2) | 2025.01.28 |
댓글 영역