Created
January 22, 2014 16:01
-
-
Save danielmatthew/8561365 to your computer and use it in GitHub Desktop.
The essence of a linked list in JavaScript
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
// A single node | |
var node1 = { | |
data: null, | |
next: null | |
}; | |
// Add data to node | |
node1.data = 12; | |
// Create another node | |
var node2 = { | |
data: null, | |
next: null | |
}; | |
// Link (aha!) first node to second | |
node1.next = node2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment