javascript json array copy value not ref.

array 복사는 간단하게 slice로.
https://www.w3schools.com/jsref/jsref_slice_array.asp

let dataA = {
    label1: 'test1',
    label2: 'test2',
}

let dataB = dataA
dataB.label1 = 'test0'

위와 같이 했을 때 dataB는 레퍼런스 참조를 해서 dataA.label1도 test0으로 변경된다.
말 그대로 값만 복사해서 따로 데이터를 처리하고 싶을 때는 JSON을 이용한다.

let dataB = JSON.parse(JSON.stringify(dataA))
dataB.label1 = 'test0' // dataB.label1만 변경된다.