You are viewing a single comment's thread. Return to all comments →
Javascript
function deleteNode(llist, position) { if(position === 0) { return llist.next; } let prevNode = null; let node = llist; let index = 0; while(node) { if(index === position) { prevNode.next = node.next break; } prevNode = node; node = node.next; index++; } return llist; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete a Node
You are viewing a single comment's thread. Return to all comments →
Javascript