We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e5dc3f8 commit 438df66Copy full SHA for 438df66
1 file changed
code/solutions/04_3_a_list.js
@@ -17,7 +17,9 @@ function prepend(value, list) {
17
}
18
19
function nth(list, n) {
20
- if (n == 0)
+ if (!list)
21
+ return undefined;
22
+ else if (n == 0)
23
return list.value;
24
else
25
return nth(list.rest, n - 1);
0 commit comments