Skip to content

Instantly share code, notes, and snippets.

@RomanTurner
Created April 7, 2021 22:27
Show Gist options
  • Save RomanTurner/8bb2262d3aa6098ad735efc41179939f to your computer and use it in GitHub Desktop.
Save RomanTurner/8bb2262d3aa6098ad735efc41179939f to your computer and use it in GitHub Desktop.
Turns LL into Array
//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