1 2 3 4 5 6 7 8 9 10 11 12 13 | 5x 4x 1x | export default function createLinkedList(items) { function advanceList(toIndex) { return { value: items[toIndex], next: function getNextItem(nextIndex) { return advanceList(nextIndex); }.bind(null, toIndex + 1), }; } return advanceList(0); } |