残缺可运行代码
class Node{ constructor(data) { this.data = data this.next = null }}class LinkedList{ constructor() { this.head = null this.length = 0 } append(data) { const newNode = new Node(data) if (this.length === 0) { this.head = newNode } else { let current = this.head while (current.next) { current = current.next } current.next = newNode } this.length++ }}// const linkedList = new LinkedList()linkedList.append('AA')linkedList.append('BB')linkedList.append('CC')console.log(linkedList)