Created
April 12, 2017 04:58
-
-
Save d3ep4k/d1ffa26d217a6a2be6e73ee7d9dd9f85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fact(n) { | |
if (n <= 1) { | |
return 1 | |
}else{ | |
return fact(n-1)*n | |
} | |
} | |
function reverse(name) { | |
if (name.length == 1) { | |
return name | |
}else{ | |
return reverse(name.substring(1, name.length)) + name.charAt(0) | |
} | |
} | |
console.log(reverse('irfan')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment