낭만코더

썸네일 자바스크립트 얕은 복사, 깊은 복사 얕은 복사 복사된 객체가 원본 객체와 같은 주소를 참조하는 것을 말한다. 얕은 복사를 하는 세 가지 방법 Array.prototype.slice() const source = [ {city: '서울'}, {city: '인천'} ] const target = source.slice() target[0].city = '부산' console.log(source[0] === target[0]) // true console.log(source[0].city) // 부산 Object.assign(source, target) const source = [ {city: '서울'}, {city: '인천'} ] const target = {} Object.assign(target, source) target[0].city..
이전 1 다음
프로필사진

  • 분류 전체보기 (28)
    • android (16)
    • springboot (8)
    • javascript (1)
    • mysql (3)
    • 끄적끄적 (0)
라이브러리 브랜드 그룹 | 낭만코더
맨 위로

티스토리툴바