I heard recursive function is powerful so instead going through loop i tried to create a function which increments a number until it reach certain points. when it reaches i trie
Well you could just use the return statement and you can check the code in the console like
var i=1; function rec(){ i++; console.log(i); if(i > 100){ return i; }else{ return rec(); } } console.log(rec());