This project implements a custom Linked List data structure in JavaScript using ES6 modules. The LinkedList class provides a comprehensive set of methods for manipulating and interacting with a singly linked list.
- Create and manage a linked list
- Basic operations: append, prepend, insert, remove
- Utility methods: size, head, tail, find
- String representation of the list
append(value): Add a node to the end of the listprepend(value): Add a node to the start of the listsize(): Get the total number of nodeshead(): Get the first nodetail(): Get node last nodeat(index): Get node at a specific indexpop(): Remove the last nodecontains(value): Check if a value exists in the listfind(value): Find the index of a valuetoString(): Convert list to a string representationinsertAt(value, index): Insert a node at a specific indexremoveAt(index): Remove a node at a specific index
- Clone the repo
- Ensure you have Node.js installed
- Run with
node main.mjs
const placesToVisit = new LinkedList();
placesToVisit.append(" Norway ");
placesToVisit.prepend(" Finland ");
console.log(placesToVisit.toString());- Understand linked list data structure
- Practice JavaScript class implementation
- Explore ES6 module syntax