Skip to content

Instantly share code, notes, and snippets.

View Tellisense's full-sized avatar
🏆
React Ninja

Justin® Tellisense

🏆
React Ninja
  • United States
View GitHub Profile
@Tellisense
Tellisense / Advanced Array methods: Native javascript code for forEach, map, filter, reduce, every, some
Last active July 7, 2022 00:40
Creating our own advanced Array methods: forEach, map, filter, reduce, every and some, using native javascript code, so that we can understand them better.
//forEach
Array.prototype.myforEach = function(cb) {
for (let i = 0; i < this.length; i++){
cb(this[i], i, this);
}
return undefined;
};
@alexhawkins
alexhawkins / nativeJavaScript.js
Last active February 2, 2024 16:57
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests