Skip to content

Instantly share code, notes, and snippets.

@kaw2k
Created January 23, 2016 02:31
Show Gist options
  • Save kaw2k/16ad1e6f489702106182 to your computer and use it in GitHub Desktop.
Save kaw2k/16ad1e6f489702106182 to your computer and use it in GitHub Desktop.
function listNode(value, next) {
return {
value: value,
next: next
};
}
var three = listNode(3);
var two = listNode(2, three);
var one = listNode(1, two);
// Or more concisely
var one = listNode(1, listNode(2, listNode(3)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment