Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 65
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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