Write the methods below as extensions to the LinkedList class.
Extend the linked list with these three different methods:
.append(value)(adds a new node with the givenvalueto the end of the list)
Input: a stringvalue
Output: a node with thevalueinserted at the end of the list
Edge Case(s):
- If linked list is empty (head = null), the new node should be the head
 
.insertBefore(value, newVal)(adds a new node withnewValimmediately before the first node containingvalue)
Input: avaluestring to search for, anewValstring to insert in a new node beforevalue
Output: a node with thenewValinserted before the searchedvalue
Edge Case(s):
- Attempting to insertBefore() the head node should divert to insert() instead.
 
.insertAfter(value, newVal)(adds a new node withnewValimmediately after the first node containingvalue)
Input: avaluestring to search for, anewValstring to insert in a new node aftervalue
Output: a node with thenewValinserted after the searchedvalue
Edge case(s):
- Attempting to insertAfter() the tail node should divert to append() instead.
 
Write tests to prove the following functionality: