DEV Community

Discussion on: Stacks and Queues in JS with es6 classes and Array

Collapse
 
kenbellows profile image
Ken Bellows

Cool idea to use subclasses of native types this way! One comment: for dequeue(), it's probably cleaner and clearer to use this.shift() rather than splicing.

Collapse
 
dilantha111 profile image
Dilantha

Thank you so much @Ken Bellows Added the change. Yes this.shift() is cleaner than splice.