Created
April 7, 2021 22:27
-
-
Save RomanTurner/8bb2262d3aa6098ad735efc41179939f to your computer and use it in GitHub Desktop.
Turns LL into Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Convert the stack to an array | |
toArray = () => { | |
let arr = []; | |
let current = this.head; | |
while(current){ | |
arr.push(current.element); | |
current = current.next; | |
} | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment