Skip to content

Instantly share code, notes, and snippets.

@oakbow
Last active December 28, 2015 04:19
Show Gist options
  • Select an option

  • Save oakbow/7442055 to your computer and use it in GitHub Desktop.

Select an option

Save oakbow/7442055 to your computer and use it in GitHub Desktop.
be able to use 'Array:indexOf' on IE8.
unless "indexOf" of Array::
Array::indexOf = (find, i) ->
i = 0 if i is `undefined`
i += @length if i < 0
i = 0 if i < 0
n = @length
while i < n
return i if i of this and this[i] is find
i++
-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment