javascript - Search in Array makes browser crash -
basically i´m getting data 2 external sources , wish compare both.
first i´m getting data xml using ajax , put in array inside array:
var array1 = []; //outside ajax ... var valuetopush = new array(); valuetopush[0] = zz; valuetopush[1] = aa; array1.push(valuetopush);
then i´m getting post php file scrapped html file, meanwhile i´m trying compare both data xml , scrapped html (using date time), using if statement limit search:
if (lng < (-18)) { for(var i=0, len = array1.length; i<len; i++) { var date1 = array1[i][1]; if (date2 == date1) { alert("equal"); } else { //do else } } }
well firefox starts getting >1gb of ram , browser crash (sometimes can stop script). problem (i think) in "for(var i=0, len = array1.length;
anyone can point me out solution?
thanks
edit: live version of site crashing. removing 435-449..resolves issue of crashing, doesnt compare data. http://preview.tinyurl.com/mf9g9fq
edit2: following comments, edited code simpler version. has 2 tables, 1 return events scrapped html "if long < 18", other table return events "long > 18". uncommenting 183 - 200 make browser crash. notice after uncommenting, in first table repeat infinitely first result "if long < 18".
working commented - http://preview.tinyurl.com/mf9g9fq
crashing uncommented - http://preview.tinyurl.com/m59p4wf
edit3 following crazy train user suggestion, replaced i letter ex j in for, , solved problem! explanation of cause of in below comments. crazy train!
Comments
Post a Comment