我在Internet Explorer控制台中遇到了这个错误:“对象不支持属性或方法'isInteger'”,我该如何解决?
代码:
是的,我传递的是数字而不是字符;
代码:
function verificaNota(nota){
if (nota.length>0){
var arr = [];
if( nota.indexOf(".") != -1 ){
return ferificareArrayNote(nota.split('.'));
}else if( nota.indexOf(",") != -1 ){
ferificareArrayNote(nota.split(','));
}else if( nota.length<=2 && Number.isInteger(Number(nota)) && Number(nota)<=10 && Number(nota) > 0){
return true;
}else {
return false;
}
}
return true;
}
是的,我传递的是数字而不是字符;
.isNumber
是 ES6 的一部分,不支持 IE11:浏览器兼容性。 - Andreas