MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/shittyprogramming/comments/sqrh4j/reimplementing_arrayprototypeforeach/
r/shittyprogramming • u/MkemCZ • Feb 12 '22
9 comments sorted by
7
For context:
My colleague called me lazy and said that my implementation would look like this:
Array.prototype.myEach = Array.prototype.forEach;
So I made this code on a Saturday morning to prove him wrong and to have fun coming up with this impractical but functional solution.
11
Am I dumb or does this not even return anything lmao
4 u/MkemCZ Feb 13 '22 It's supposed to return undefined as per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach . It even works with all the examples on the page. 12 u/danielsamuels Feb 13 '22 Array#forEach doesn't return anything
4
It's supposed to return undefined as per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach . It even works with all the examples on the page.
undefined
12
Array#forEach doesn't return anything
3
What did u use to create this image
7 u/nikhilmwarrier Feb 13 '22 Most probably carbon 1 u/MkemCZ Feb 13 '22 That's correct. 1 u/Safe-Estimate-2277 Feb 13 '22 I thought this wasn’t carbon
Most probably carbon
1 u/MkemCZ Feb 13 '22 That's correct. 1 u/Safe-Estimate-2277 Feb 13 '22 I thought this wasn’t carbon
1
That's correct.
I thought this wasn’t carbon
7
u/MkemCZ Feb 13 '22
For context:
My colleague called me lazy and said that my implementation would look like this:
Array.prototype.myEach = Array.prototype.forEach;So I made this code on a Saturday morning to prove him wrong and to have fun coming up with this impractical but functional solution.
11
u/backtrackthis Feb 13 '22
Am I dumb or does this not even return anything lmao
3
u/Safe-Estimate-2277 Feb 13 '22
What did u use to create this image