admin管理员组文章数量:1277910
i've got two devices one with Lollipop and one with Kitekat... the one with Lollipop does not report any error but when i try my application i obtain this error:
10-13 16:56:56.126: I/chromium(6322): [INFO:CONSOLE(99)] "Uncaught
TypeError: Object ALIM. IL SOLE DI LOPARDO MARIANGELA has no
method 'startsWith'", source: file:///android_asset/www/soggetti3.html (99)
here is a part of my javascript:
function onDeviceReady() {
window.rancolor=ranColor();
var ricerca=localStorage.getItem('testo_ricerca');
var risultati = JSON.parse(localStorage["risultati"]);
var ricerca1=ricerca.toString();
ricerca1=ricerca1.toUpperCase();
var res_match=[];
var lll=risultati.length;
for(var r=0;r<lll;r++){
var ppp0=risultati[r][1].toString();
var ppp1=risultati[r][0].toString();
var ppp2=risultati[r][2].toString();
var ppp3=risultati[r][3].toString();
ppp0=ppp0.toUpperCase();
alert(ppp0);
alert(ricerca1);
var check=ppp0.startsWith(ricerca1);
if(check==true){
res_match=res_match.concat([[ppp1,ppp0,ppp2,ppp3]]);
}
}
var y=res_match.length;
how should i search an array of strings searching the strings that begin with some other string?
i've got two devices one with Lollipop and one with Kitekat... the one with Lollipop does not report any error but when i try my application i obtain this error:
10-13 16:56:56.126: I/chromium(6322): [INFO:CONSOLE(99)] "Uncaught
TypeError: Object ALIM. IL SOLE DI LOPARDO MARIANGELA has no
method 'startsWith'", source: file:///android_asset/www/soggetti3.html (99)
here is a part of my javascript:
function onDeviceReady() {
window.rancolor=ranColor();
var ricerca=localStorage.getItem('testo_ricerca');
var risultati = JSON.parse(localStorage["risultati"]);
var ricerca1=ricerca.toString();
ricerca1=ricerca1.toUpperCase();
var res_match=[];
var lll=risultati.length;
for(var r=0;r<lll;r++){
var ppp0=risultati[r][1].toString();
var ppp1=risultati[r][0].toString();
var ppp2=risultati[r][2].toString();
var ppp3=risultati[r][3].toString();
ppp0=ppp0.toUpperCase();
alert(ppp0);
alert(ricerca1);
var check=ppp0.startsWith(ricerca1);
if(check==true){
res_match=res_match.concat([[ppp1,ppp0,ppp2,ppp3]]);
}
}
var y=res_match.length;
how should i search an array of strings searching the strings that begin with some other string?
Share Improve this question edited Oct 13, 2015 at 15:05 Lorenzo asked Oct 13, 2015 at 15:02 LorenzoLorenzo 6731 gold badge11 silver badges26 bronze badges 2- please post some code for soggetti3.html – Dilberted Commented Oct 13, 2015 at 15:03
- see the edits, thank you ... – Lorenzo Commented Oct 13, 2015 at 15:05
1 Answer
Reset to default 13The easiest way to implement the startWith function is shown below, then you can use startsWith in your code:
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
本文标签: Cordova javascript error has no method startsWith AndroidStack Overflow
版权声明:本文标题:Cordova javascript error: has no method startsWith Android - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741287616a2370362.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论