I wrote polyfills for 32 JavaScript Array methods!
Introduction
While working on projects, I used many JavaScript methods. I was curious about their implementation. So, I tried to implement some of them and it was fun! Fast forward to today, I wrote polyfills for 32 JavaScript Array methods.
In this...
blog.siddhigate.com24 min read
Rob Balmf
Hi Siddhi, many thanks for sharing these very useful functions. Just wanted to let you know about a minor bug in "myFindLastIndex". It starts its search one position beyond the end of the array, so the first item the callback is given is "undefined", which can cause an exception if a property of the item is being checked e.g. "item => item.foo === 'bar'".
This: for (let i = this.length; i >= 0; i--) {
Should be: for (let i = this.length - 1; i >= 0; i--) {
All the best