Last active
April 12, 2016 20:33
-
-
Save spanuska/f9007e79cf31d058bdf8823c31ee174f to your computer and use it in GitHub Desktop.
This file contains 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
function nth(list, index) { | |
for (var node = list; node; node = node.rest) { | |
if (index == 0) { | |
return (node.value || undefined); | |
} else { | |
nth(node.rest, index--) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment