Skip to content

Instantly share code, notes, and snippets.

@kulicuu
Last active June 26, 2016 16:07
Show Gist options
  • Select an option

  • Save kulicuu/29950b28ca210f16e14a36dd268bcfa8 to your computer and use it in GitHub Desktop.

Select an option

Save kulicuu/29950b28ca210f16e14a36dd268bcfa8 to your computer and use it in GitHub Desktop.
coffeescript in place string reverse
exports.rev = rev = (str) ->
rayy = str.split ''
idx = 0
jdx = rayy.length - 1
while idx < jdx
cursor = rayy[idx]
rayy[idx] = rayy[jdx]
rayy[jdx] = cursor
idx++
jdx--
return rayy.join('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment