Recursion Made Simple with Roman Numerals

A procedure is recursive if it invokes itself. Thus: const toInfinityAndBeyond = num => toInfinityAndBeyond(num + 1); Of course, toInfinityAndBeyond is only useful if, rather than seeking an answer, you want to blow your call stack. But you see the point: we find toInfinityAndBeyond in its own body. What possible use could this be? Recursion is often well suited to express the logic of a problem. Let’s take a simple problem: the conversion of Roman to Arabic numerals. One solution is this one: ...

2017-07-17 · 5 min · 876 words · Thomas Cothran