Skip to content

Instantly share code, notes, and snippets.

@Chris927
Created July 13, 2011 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Chris927/1079916 to your computer and use it in GitHub Desktop.
Save Chris927/1079916 to your computer and use it in GitHub Desktop.
Reverse a string in CoffeeScript
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