So I created a linked list object in js…I won’t explain i’ll just give an example with arrays
arr =[0, 1] console.log(arr); //[0, 1] arr.pop(); console.log(arr) //
But when I do myLinkedListRef (with say List of //2–>3–>6)
console.log(myLinkedListRef)//3 ->6 myref.removeFirst(); console.log(myLinkedListRef) //3->6
They are both the same!!!
Point i s that the remove method in linked list removes the value before the console log message is displayed the old value. Is there no way around this?
I was hoping the first message would log original list then the next would log the original list without first element but they are both logging list without first element