-
-
Save utgarda/2158025 to your computer and use it in GitHub Desktop.
Reverse a string in CoffeeScript
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
reverse = (s) -> | |
if s.length < 2 then s else reverse(s[1..-1]) + s[0] | |
s = "Hello" | |
console.log "s=#{s}, s.reverse=#{reverse(s)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
np5q49815q3496psr7207noppr23n244
p0477p71