Internet Explorer 11 : Object doesn't support property or method 'isInteger'

后端 未结 1 1375
-上瘾入骨i
-上瘾入骨i 2021-01-17 08:43

i have this error in internet explorer console \' Object doesn\'t support property or method \'isInteger\' \' how can i resolve it ?

code:

    functi         


        
1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-17 09:12

    As stated by @Andreas, Number.isNumber is part of ES6 so not supported by IE11

    You can add the following polyfill to you javasript

    Number.isInteger = Number.isInteger || function(value) {
        return typeof value === "number" && 
               isFinite(value) && 
               Math.floor(value) === value;
    };
    

    source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger

    0 讨论(0)
提交回复
热议问题