Skip to content

Instantly share code, notes, and snippets.

@st98
Created June 21, 2014 17:39
Show Gist options
  • Save st98/e08e5710060a32efc96c to your computer and use it in GitHub Desktop.
Save st98/e08e5710060a32efc96c to your computer and use it in GitHub Desktop.
CoffeeScript で、配列の中で一番長い要素の長さを返す関数。参照: http://stackoverflow.com/a/6521513
# ref. http://stackoverflow.com/a/6521513
Array::longest = ->
return @reduce ((prev, curr) -> return if prev > curr.length then prev else curr.length), 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment