Skip to content

Instantly share code, notes, and snippets.

@danielmatthew
Created January 22, 2014 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmatthew/8561365 to your computer and use it in GitHub Desktop.
Save danielmatthew/8561365 to your computer and use it in GitHub Desktop.
The essence of a linked list in JavaScript
// 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