Select Node in a Linked List

Hello there,

Anyone know how I can select the node before a desired node in a linked list with Javascript ?

Lets say for example that I have a linked list as below

Arsenal Chelsea Barca Milan Inter Bayern

Lets also say that the fourth node (Milan) is the desired node as “Milan” is the data I want, can you describe a method that will enable me select the node that holds “Barca” as that is the node that precedes/holds the pointer to the desired node.

I don’t know of any way to do that with a regular linked list
(besides maybe iterating through all the nodes and checking if there’s a node that’s linked to the one whose data is “Milan”).

I think doubly linked lists are used for this kind of thing instead.

I would say checking the next node for the desired value should work. Then return the current node if the next node has the value, otherwise move forward in the list.

Thanks, I appreciate your response