When doing this:
var a = new Array("a", "b"); a.map(function() { });
in IE8 I get:
"Object doesn't support this property or method"
Is this method not supported in IE8, or do I have some other problem? I've had a Google, but get lots of Google Maps javascript issues/questions...
Edit: OK so IE8 and below DO NOT support the .map() function. Copy-paste the code from MDN here which will add the .map() function to the Array prototype exactly per the specs if not natively supported (and it seems to work perfectly).
Generally map() method is used to iterate over an array and calling function on every element of array. Parameters: This method accepts two parameters as mentioned above and described below: function(currentValue, index, arr): It is required parameter and it runs on each element of array.
map() creates a new array from calling a function for every array element. map() calls a function once for each element in an array.
The last version of the Maps JavaScript API to support Internet Explorer 11 is v3. 47. Support for Internet Explorer 11 will be entirely discontinued in November 2022. This also applies to the IE mode in Edge.
The solution is jQuery.map
Instead of this: a.map(function( ) { });
You have to do
jQuery.map(a, function( ) { //what ever you want todo .. }
IE8 doesn't support map()
. When in doubt, check MDN (Mozilla Developer Network):
map - MDN
Looks like IE added support for map()
in version 9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With