Skip to content

Instantly share code, notes, and snippets.

@xiaoyunyang
Last active January 25, 2018 09:00
Show Gist options
  • Save xiaoyunyang/a852668ff84ace04eacaf0cb11138948 to your computer and use it in GitHub Desktop.
Save xiaoyunyang/a852668ff84ace04eacaf0cb11138948 to your computer and use it in GitHub Desktop.
Closure With Recursion
var myFun2 = function() {
var num = -1
function incrementUntil(max) {
if(num >= max) return num
num++
incrementUntil(max)
}
incrementUntil(3)
return num
}
myFun2() //> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment