Skip to content

[문제] 객체의 불변성 #16

@live-small

Description

@live-small

질문

스프레드 문법을 통해 객체의 불변성을 지킬 수 있습니다.
이 외에 객체의 불변성을 지킬 수 있는 다른 방법은 뭐가 있을까요?
또, 불변성을 신경쓰는 것에 대한 생각을 공유해주세요 : )

관련 챕터

35장

참고

const order = {id: 1, order: 'Americano', addMilk: true};
const change = {addMilk: false}; 
const newOrder = {...order, ...change }; // output: {id: 1, order: "Americano", addMilk: false}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions