選択した製品に基づいて商品詳細オブジェクトを分類しようとしています。オブジェクト1011にメソッド 'startsWith'がありません
if (prodCode.startsWith("1") || prodCode.startsWith("4")) {
ProductDetails = obj.MachineDetails;
}
else if (prodCode.startsWith("6")) {
if (prodCode.charAt(3) == '3' || prodCode.charAt(3) == '4') {
ProductDetails = obj.BoxDetails;
}
else {
ProductDetails = obj.SomeDetails;
}
}
else if (prodCode.startsWith("2") || prodCode.startsWith("3")) {
ProductDetails = obj.SomeOtherDetails;
}
罰金のAndroid 4.4を超える作業が、アンドロイド4.4でエラーが発生しますだ:
オブジェクト1011は 'のstartsWith'
1011
が私の製品コードである方法はありません。
誰にもその理由が分かりますか?
'console.log(String.prototype.startsWith);と' console.log(typeof prodCode); 'の出力を共有できますか? – gurvinder372
Polyfillで試してみるhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill – Satpal