Skip to content

Instantly share code, notes, and snippets.

@hyukkwonepic
Created December 9, 2018 06:44
Show Gist options
  • Save hyukkwonepic/d1dbe9e569d827a378a269cb682d6697 to your computer and use it in GitHub Desktop.
Save hyukkwonepic/d1dbe9e569d827a378a269cb682d6697 to your computer and use it in GitHub Desktop.
iterate() {
let node = this.head
while (node) {
console.log(node.data)
node = node.next
}
}
search(data) {
let idx = 0
let node = this.head
while (node) {
if (node.data === data) return idx
node = node.next
idx += 1
}
return -1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment