Created
March 4, 2017 09:45
-
-
Save tjukic/705294a5deebf4cd9766237163084507 to your computer and use it in GitHub Desktop.
Search by obj prop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.indexOfIfPropertyMatches = function(callback) { | |
var i = this.length; | |
while (i--) { | |
if (callback(this[i], i)) { | |
return i; | |
} | |
} | |
return -1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment