Complete the code to create a new node with the given value.
const newNode = new Node([1]);The new node should be created with the value passed as value.
Complete the code to check if the list is empty (head is null).
if (this.head [1] null) {
We check if this.head is exactly equal to null to know if the list is empty.
Fix the error in the loop condition to find the last node.
while (current.[1] !== null) { current = current.next; }
prev instead of next in the loop condition.To traverse to the end, we move using the next pointer until it is null.
Fill both blanks to correctly link the new node at the end.
current.[1] = newNode; newNode.[2] = current;
next and prev assignments.head or tail properties incorrectly.The current last node's next points to the new node, and the new node's prev points back to current.
Fill all three blanks to update the list when inserting the first node.
this.head = [1]; this.tail = [2]; newNode.[3] = null;
prev to null instead of next.head and tail.When the list is empty, both head and tail point to the new node, and its next is null.
