DEV Community

Discussion on: Data Structures & Algorithms in JavaScript(Single Linked List) Part 1

Collapse
 
buffdogg profile image
Drew Patterson • Edited

FYI. You have a bug in your insert method. this.count++; should be inside your if block. If the method receives a position that is out of bounds it still increases the size of the list without inserting the element.