DEV Community

Discussion on: JavaScript Data Structures: Singly Linked List: Shift

Collapse
 
redraushan profile image
Raushan Sharma

Thanks for your work, just one thing I see which I find unnecessary is the else block after even though you are already returning above.

 //  instead of this
 if (!this.length) {
      return null;
    } else { 
   // do something
    }

// we can simply write 
if (!this.length) return null;
// do something