#Javascript Interview Question that was asked to me in the interview π
Q. Create a polyfill for "Array.prototype.forEach" from scratch.β
ππ¨π₯π²ππ’π₯π₯π¬: are nothing but functions or features that older browsers donβt support and if we donβt write some replacement functions, code will throw a run time error.
Custom myforEach Method:
β’ Implements your version of a loop that goes through every item in an array.
Loop Through Array
β’ "myForEach" method runs a loop on the array, from the first item to the last.
β’ You tell it to "do something" for every item in the array, in this case, to print each item.
β’ You see that callback, nothing just the function that you passed, and that function is hit every time till array.length.
as you can see in the code below β¬οΈ
So that is it for today.
See you tomorrow π€.
Before leaving me .............β
π Follow:
@iamadix_
β» Repost if you learn something new today.
π§βπ¦° Tag a person learning React, Angular & Javascript.
π Press the bell icon so that you don't miss any posts.
~ Aditya Singh (JS Guy)
#javascriptarray #javascriptcoding
#coding #programming #softwaredevelopment #systemdesign #AngularDev #tuesday #frontend #react #angular #javascript #frontend #backend #viral #NewsZERO #methods #100DaysOfCode