To start off, any kind of prepending and appending methods will need to know where the beginning and end of the linked list is. Thus, we know we need a head and tail reference, so we can start with this snippet as the function constructor.

JAVASCRIPT
OUTPUT
Results will appear here.