(function (Array) {
	const EACH_ERROR = 'Function Each already exist';
	const WHERE_ERROR = 'Function Where already exist';

	var extensions = {
		'each': { method: each, error: EACH_ERROR },
		'where': { method: where, error:WHERE_ERROR}
	};

	function each(callback) {
		var length = this.length;
		var index = 0;

		while (index < length) {
			callback.call(null, this[index], index);
			index++;
		}
	}

	function where(callback) {
		var length = this.length;
		var index = 0;
		var newArray = [];

		while (index < length) {
			let response = callback.call(null, this[index]);
			if (response === true) {
				newArray.push(this[index])
			}
			index++;
		}
		return newArray;
	}

	for(let key in extensions) {
		if (!Array.prototype[key]) {
			Array.prototype[key]= extensions[key].method
		} else {
			throw extensions[key].error
		}
	}

})(global.Array);


@@ -18,228 +18,344 @@
  %7B%0A%09
-const EACH_ERROR = 'Function Each already exist';%0A%09const WHERE_ERROR = 'Function Where already exist';%0A%0A%09var extensions
+var extensions = %5Beach, where%5D;%0A%09var errorMessages = extensions.reduce((ext, m) =%3E %7B%0A%09%09ext%5Bm.name%5D = %60Function %22$%7Bm.name%7D%22 already exists%60;%0A%09%09return ext;%0A%09%7D,%7B%7D);%0A%0A%09extensions.forEach((element)
  =
+%3E
  %7B%0A%09%09
-'each': %7B method: each, error: EACH_ERROR %7D,%0A%09%09'where': %7B method: where, error:WHERE_ERROR
+if(!Array.prototype%5Belement.name%5D) %7B%0A%09%09%09Array.prototype%5Belement.name%5D = element%0A%09%09%7D else %7B%0A%09%09%09throw errorMessages%5Belement.name%5D;%0A%09%09
 %7D%0A%09%7D
+)
 ;%0A%0A%09
@@ -797,168 +797,8 @@
 %0A%09%7D%0A
-%0A%09for(let key in extensions) %7B%0A%09%09if (!Array.prototype%5Bkey%5D) %7B%0A%09%09%09Array.prototype%5Bkey%5D= extensions%5Bkey%5D.method%0A%09%09%7D else %7B%0A%09%09%09throw extensions%5Bkey%5D.error%0A%09%09%7D%0A%09%7D%0A%0A
 %7D)(g
@@ -810,10 +810,8 @@
 .Array);
-%0A%0A

Create error message automatically