ie8 对象不支持 extjs 代码

ie8 Object doesn't support this for extjs code

allWidth: function() {
    var me = this,
        states = me.getstates(),
        waterY = 0,
        placeY = 0,
        World;

    states.forEach(function(region) {
        World = region.getWorld();
        if (World.y < placeY) {
            placeY = World.y;
        }
        if (World.y + World.height > waterY) {
            waterY = World.y + World.height;
        }
    });

    return waterY - placeY;
},

IE8 不支持数组的 forEach 方法。您有几个选项可以解决此问题。

您可以使用普通的 for 循环:

for(var i = 0; i < states.length; i++){
    var region = states[i];
    /* ... */

由于您使用的是 extjs,因此您也可以改用 Ext.each 方法:

Ext.each(states, function(region){
...

或者您可以使用 shim/polyfill 在 IE8 中添加 forEach 方法。

您可以在 MDN here.

上找到 forEach 方法的 polyfill