Function LNode(element) {this.element = element; This.next = null; } function findPrev(index) {if (this.head. Next && index < this.length) {let tNode = this.head // While (index--) {tNode = tnode. next} return tNode} return null} function insert(lNode, index) { if (index) { let tNode if (tNode = this.findPrev(index)) { lNode.next = tNode.next tNode.next = lNode } } else { lNode.next = this.head.next this.head.next = lNode } this.length++ } function remove(index) { let lNode if (this.head.next) {if (index < this.length) {lNode = this.head // While (index--) {lNode = lnode.next } lNode.next = lNode.next.next } } } function find(index) { if (this.head.next && index < this.length) { let tNode = While (index--) {tNode = tnode. next} return tNode} return null} // export of the linked list class default function LList() { this.head = new LNode('head'); // header this.find = find; This.length = 0; This. insert = insert; This. remove = remove; This.findprev = findPrev; } llist.prototype. toString = function () {let tNode = this.head const toStrArr = [] let length = this.length while (length--) { tNode = tNode.next tNode && toStrArr.push(tNode.element) } return toStrArr } const lList = new LList() for (let i = 0; i < 10; i++) { lList.insert(new LNode('data' + i)) } lList.insert(new LNode('datamy'), 1) console.log(LList.prototype) console.log(lList) console.log(lList.toString()) // console.log(lList.head.next,) // lList.remove(1) // console.log(lList.head.next,) // console.log(lList.find(2)) // console.log(LList.prototype.prototype)Copy the code