function Node(data) {
this.data = data;
this.next = null
}
function LinkedList() {
var _length = 0;
var _head = null;
}
LinkedList.prototype.append = function(data) {
var node = new Node(data);
var curr;
if (this._head == null) {
this._head = node;
} else {
curr = this._head;
while (curr.next) {
curr = curr.next;
}
curr.next = node;
}
this._length++;
}
var list = new LinkedList();
list.append(15);
list.append(10);
list.append(5);
list.append(3);
참고한 사이트
소https://boycoding.tistory.com/33
'Javascript' 카테고리의 다른 글
파일(Image) 용량을 확인하는 방법_v1 (0) | 2019.06.05 |
---|---|
배열의 중복값 제거 (0) | 2019.04.25 |
다수의 엘리먼트에 이벤트 등록하기 (0) | 2019.04.11 |
base64 인코딩, 디코딩하기! (0) | 2019.04.11 |
[Object] Object 다루기 - map, filter 로 값 추출하기 (0) | 2019.04.11 |