• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 70
  • Last Modified:

Alert not firing

Any idea why my alert is not firing in my jsfiddle?
https://jsfiddle.net/isogunro/btft1Lys/1/
0
Isaac
Asked:
Isaac
1 Solution
 
Brian TaoSenior Business Solutions ConsultantCommented:
Your script has 2 problems (actually 3 but 2 of them are the same).  In
for(x=0; x<=ary.length; x++){
    for (i=0; i<=ary.length; x++){
        tbl += "<tr><td>"+ary[x][i]+"</td><td>"+ary[x][1]+"</td></tr>";
        //alert(tbl);
    }
}

Open in new window

  1. You should change "<=" to "<" in both for loops, otherwise it will iterate through the non-existing ary[ary.length] which throws an exception.
  2. In the inner loop, you have a typo: it should be "i++" instead of "x++"
0
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
Thanks!
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now