LewisMarz icon

Sum-Recursion-JS

LewisMarz | PRO | 09/17/16 09:19:43 PM UTC | 0 ⭐ | 242 👁️ | Never ⏰ | []
JavaScript |

240 B

|

None

|

0 👍

/

0 👎

// This JS function uses recursion to reproduce the action of a for loop.
var loop = function(i) {
    var limit = 10; // Called limit for clarity.
    if (i < limit) {
        return loop(i + 1);
    }
    return i;
}
 
console.log(loop(1));

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎