#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