LIST in Javascript

Difference between Array and List in Javascript
Array
- is a set of sequential items.
- has an index for each item.
List
- is a set of items(=node) ordered sequentially.
- does not have an index for each item, but it has the reference for it’s next value
Can I access the item directly or sequentially?
Array
- can access items either directly or sequentially.
List
- can only be accessed sequentially. Because the list is stored in memory.

How to create List in Javascript?
First, you will need to make a Node that has value, reference of previous node and reference of next node.
Next, create a class name LinkedList.
There are 5 functions inside of the LinkedList class, of course this can have more than 5.
Let’s test


- Create a new linked list that named list
- add to tail a value 2, 4, 6
- Test them out