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

Re: [jslint] "Use the array literal notation []."

Expand Messages
  • Stoyan Stefanov
    One possible pitfall is if by any chance you pass something that is not an integer to the Array constructor new Array(3) is like [undefined, undefined,
    Message 1 of 5 , Mar 6 4:52 PM
    • 0 Attachment
      One possible pitfall is if by any chance you pass something that is not an
      integer to the Array constructor

      new Array(3) is like [undefined, undefined, undefined]
      new Array(Œtest¹) is like [Œtest¹]
      new Array(3.14) is a RangeError

      Best,
      Stoyan

      >> > I'm not exactly sure why using the Array constructor would be bad,
      > except possibly because someone else might have redefined it. So in
      > that case should I be writing this?



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.