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

Array of array undefined...

Expand Messages
  • santini.alberto
    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
    Message 1 of 2 , 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
    • Douglas Crockford
      ... Finding those statically in general is very hard.
      Message 2 of 2 , Jul 19, 2008
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "santini.alberto"
        <albertosantini@...> wrote:
        > 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 = [];
        > Amat[0][0] = 5; // error, Amat[0] is undefined

        Finding those statically in general is very hard.
      Your message has been successfully submitted and would be delivered to recipients shortly.