Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created September 15, 2015 20:27
Show Gist options
  • Save commuterjoy/37b99f9ecd8c93bb0bab to your computer and use it in GitHub Desktop.
Save commuterjoy/37b99f9ecd8c93bb0bab to your computer and use it in GitHub Desktop.
extract the first and last characters of a string
"apple"
.split("")
.filter(function(a, b, c) { return b === 0 || b === c.length-1 })
.join(" ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment