[英]isIntegar polyfill fix on IE11
I have some JavaScript that uses isIntegar, I understand I need to add polyfill but am confused on how to do this with my code. 我有一些使用isIntegar的JavaScript,我知道我需要添加polyfill,但是对于如何使用我的代码感到困惑。
IE dose not currently like my code IE浏览器目前不喜欢我的代码
My code 我的密码
if (!Number.isInteger(averageRatingResult)) {
for (var j = 0; j < averageRatingResult; j++) {
if (averageRatingResult - j < 1) {
averageRating += '<i class="fa fa-star-half rating-stars" aria-hidden="true"></i>';
}
else {
averageRating += '<i class="fa fa-star rating-stars" aria-hidden="true"></i>';
}
}
}
else {
for (var j = 0; j < averageRatingResult; j++) {
averageRating += '<i class="fa fa-star rating-stars" aria-hidden="true"></i></span>';
}
}
Error I am getting 我收到错误
SCRIPT438: Object doesn't support property or method 'isInteger' ratingswigetcontent.js (21,9) SCRIPT438:对象不支持属性或方法“ isInteger”的评级wigetcontent.js(21,9)
Maybe something simpler like this will do 也许像这样更简单的事情会做
if (averageRatingResult === parseInt(averageRatingResult, 10))
Depends more on what your potential value it can be 取决于您的潜在价值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.