articles » current » javascript » ie11 » ie11-prototype-array-find

JavaScript: IE11 Array.find() Method/Function

Create the Array.find() function for Internet Explorer 11.

Still developing for IE11? Well, the find() method returns the value of the first element that passes a test.

if (!Array.prototype.find) {
	Array.prototype.find = function (func) {

		if (this == null) {
			throw new Error('this is null or not defined');

		var O = Object(this);

		var len = O.length >>> 0;
		for (var i = 0; i < len; i++) {
			if (func(O[i])) {
				return O[i];
		return undefined;

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.