0

Can someone help with explaining a linkedlist in Javascript

I've read the tutorial loads of time now but I just don't get it. The naming system is confusing. Like self.head = Node(data, self.head) wasnt self.head null moments ago? What's happening? while curr.next: curr = curr.next so much reassignment, using the same name over and over without comments makes this stuff so hard to read. What does curr mean? Current? Earlier in the node class they said they have data and a link, but the second parameter is "next". Is this the link? When it printed it it returned an object. This is so confusing Can anyone help? (I'm doing it in Javascript as to not "cheat", the tutorial was made in Python and it doesn't feel right making an identical code to the tutorial) https://code.sololearn.com/Wpj3x4AJ4Nbh/?ref=app

8th May 2021, 6:46 PM
Clueless Coder
Clueless Coder - avatar
1 Resposta