Javascript Tutorial 34: Introduction To Recursion




Learn what is recursion and how to use concept of recursion in javascript.Website: http://codedamn.com
Facebook: http://facebook.com/codedammmn
Twitter: http://twitter.com/codedammer

Original source


3 responses to “Javascript Tutorial 34: Introduction To Recursion”

  1. so the concept is it resolves the lowest case first then goes upwards like when you provided it 2 it went down called it self and resolved the lowest case i.e. 1 then returned it and resolved the last case but i have some questions
    1) 1 wasn't our lowest case 0 was our case and if that is true then the function should have returned a string in our case it returned "invalid" which will eventually got multiplied with the highest number i.e. 2 now Please explain this.
    2) why the execution of the program stopped at 0 i mean why the function didn't go down below 0 i.e. -1 -2 etc because there is no check to break the function once it gets down below 0

Leave a Reply