Skip to content

Instantly share code, notes, and snippets.

@user24
Created May 7, 2018 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save user24/005ceff7cec1338229ab4bd8a18a5112 to your computer and use it in GitHub Desktop.
Save user24/005ceff7cec1338229ab4bd8a18a5112 to your computer and use it in GitHub Desktop.
var searchArray = [1,2,3];
var targetValue = 2;
// Not supported in MSIE
searchArray.find(function (val) {
return val === targetValue;
});
// Supported in MSIE
searchArray.filter(function (val) {
return val === targetValue;
})[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment