Linked List Implementation

Run Settings
LanguageJavaScript
Language Version
Run Command
class LinkedList{ constructor(value){ this.head= { value:value, next:null }; this.tail=this.head; this.length=1; } append(value){ const newNode={ value:value, next:null } // this.head.next={ // value:value, // next:null // }; console.log('thisss',this.head); console.log('thisss',this.tail) this.tail.next=newNode; this.tail=newNode; ++this.length; } } const myList= new LinkedList(10) myList.append(5) //myList.append(16) console.log(myList)
Editor Settings
Theme
Key bindings
Full width
Lines