Object doesn’t support property or method ‘forEach’ in IE

Today we’ll show you how to fix an error Object doesn’t support property or method ‘forEach’ in IE during the react application development.

Object doesn’t support property or method ‘forEach’ in IE react, forEach() not working in all browsers, IE 11 issue – .forEach() is not supported, IE11: Object doesn’t support property or method ‘forEach’, Alternative of .forEach() in Internet Explorer, Crash in IE11 for javascript usage of “forEach”.

If you look at the documentation of the forEach(), most of the browsers don’t support this property the same as find() & includes().

Way to Fix an error: Object doesn’t support property or method ‘forEach’ in IE for ReactJS

You can use the polyfill from MDN. Add the following script at the top of all imports and it will work like charm.

We will add the code in polyfill.js file and import it in React project.

polyfill.js

You have to import the above created polyfill.js file at the top of index.js/App.js file. Check the following code for your reference.

index.js

This is exactly what is needed to fix an error.

Thank you for reading. Like & Share with your friends. Happy Coding..!!

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *