📜  链表 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:57.858000             🧑  作者: Mango

代码示例1
class LinkedList {
    constructor(head = null) {
        this.head = head
    }
}

class ListNode {
    constructor(value,next=null){
        this.value = value;
        this.next = next;
    };
}

let node1 = new ListNode(2);
let node2 = new ListNode(4);
node1.next = node2;

let list = new LinkedList(node1);

console.log(list.head.next);