Question: Use JavaScript classes to create a new type called LinkedList. Since a linked list is made up of nodes, we also want to create a

Use JavaScript classes to create a new type called LinkedList. Since a linked list is made up of nodes, we also want to create a second type, Node, which defines all the nodes for our list. Create a class called Node with a constructor that takes the following variables as parameters and sets them as properties o val o next Create a class called LinkedList that takes no parameters, but declares and initializes the following property o head Create a prototype method called insert in the LinkedList class . This method takes one parameter, val, which contains the value for the new node being inserted into the list . This method inserts the new node at the end of the list Create a prototype method called find in the LinkedList class . This method takes one parameter, val, which contains the value we are searching for in the linked list . This method returns the node that contains the value, if found, otherwise, it returns null
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
