JSFiddle - React, Tailwind, and code Playground
by davestein
HTML
<h3>Using native</h3>
Will log 6 times no matter what version of IE8.
<br /><br />
<h3>Using .map</h3>
In IE8, on XP ( aka the real IE8 ), it will log 6 times - once for a_1-3 and once for 1-3.<br />
In IE8 mode on Windows 7, it works fine.<br />
<br />
Does jQuery know about this bug and compensate for it? If so, it seems there's a bug when using the "real" IE8.
JavaScript
var x = {
a_1 : 1,
a_2 : 2,
a_3 : 3
};
console.log('start');
for ( index in x ) {
val = x[ index ];
console.log( index, val );
var new_index = index.replace( 'a_', ' ', '' );
x[new_index] = val;
delete( x[index] );
}
console.log('now to try map');
var x = {
a_1 : 1,
a_2 : 2,
a_3 : 3
};
$.map( x, function( val, index ) {
console.log( index, ' ', val );
var new_index = index.replace( 'a_', '' );
x[new_index] = val;
delete( x[index] );
});
console.log( 'done' );