Trying to solve a problem with linked lists requiring the conversion of a singly linked list into doubly linked list. I'm definitely missing some syntax to do this but I haven't been able to figure out what I'm missing here.
The code is this.
var addPrev = function(head) {
let copy = head;
let prev = null;
while(copy !== null){
// The prev is just undefined console.log(copy, copy.prev);
copy[prev]=prev
prev=copy;
copy=copy.next;
};
return head;
}