목록객체참조 #객체 (1)
Hello World...
자바스크립트 객체 참조
자바스크립트 객체 참조. 객체 참조 const list = { head: null, tail: null }; let node = { value: 10, next: null }; list.tail = node; >> {value: 10, next: null} list.head = node; >> {value: 10, next: null} list.tail.next = {value: 2, next:null} >> {value: 2, next: null} list.head.next; >> {value: 2, next: null node 는 객체이므로 값 복사가 되는 것이 아니라 참조된다. list.tail 과 list.head 는 동일하게 node 객체를 가리키고 있다.
javascript
2020. 1. 2. 17:45