Loading ...
Sorry, an error occurred while loading the content.

109Array of array undefined...

Expand Messages
  • santini.alberto
    Jul 18, 2008
    • 0 Attachment
      Hello.

      I was wondering if it's possible to catch the error described by the
      snippet. I am referring not to catch the out of bound, but the lack of
      the initialization.

      var n, i;
      var Amat = [];

      n = 3;

      // Necessary to define the rows as array
      // Commented out to create the error below
      //~ for (i = 0; i < n; i = i + 1) {
      //~ Amat[i] = [];
      //~ }

      Amat[0][0] = 5; // error, Amat[0] is undefined

      Thanks in advance,
      Alberto
    • Show all 2 messages in this topic