Advertisement
PadmaJS

Untitled

Mar 1st, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. class LinkedList {
  2. constructor() {
  3. this.list = [];
  4. }
  5.  
  6. push(x) {
  7. this.list = [x , ...this.list]
  8. return x;
  9. }
  10. unshift(x) {
  11. this.list = [...this.list, x]
  12. return x;
  13. }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement