The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 8 of 8

Thread: Tutorial: Arrays in JavaScript

  1. #1

    Tutorial: Arrays in JavaScript

    Hi everyone,
    This is the happening place to discuss all things related to the Arrays in JavaScript tutorial.


    Great, now even Kirupa is { facebooking | twittering }

  2. #2
    Quote Originally Posted by kirupa in the tutorial
    While this works, in general, it isn't recommended any more.
    Perhaps ironically, the discussion that your link references kind of deconstructs the idea that using new isn't recommended "in general". Douglas Crockford's opinions and best practices aren't taken seriously by everybody. Brendan Eich, for example, can often be seen opposing Crockford's advice.

    In my opinion, [] vs. new Array is a non-issue, in the sense that I'd never feel the need to convert somebody else's use of one form to the other, and I've never seen anybody accidentally use new Array(5) to mean [5]. I've also never seen a situation where someone overrode Array. If it were to happen accidentally, you would not feasibly be able to continue working on your site/app without immediately noticing that related uses of Array were causing errors.

    I'm not happy with your decision to recommend against that use case, although I think it's a trivial part of the tutorial.

  3. #3
    TheCanadian's Avatar
    Noo doot aboot it, eh?
    I've found that 99% of "best practices" are 99% subjective.
    Proud Montanadian
    We tolerate living and breathing. And niches.

    Name Brand Watches

    Maybe getTimer() or TweenMax is the answer to your problem . . .

  4. #4
    Kril - that is a fair point. I will describe both cases.

    Great, now even Kirupa is { facebooking | twittering }

  5. #5
    Quote Originally Posted by TheCanadian View Post
    I've found that 99% of "best practices" are 99% subjective.
    I agree.

    Sometimes I comment on these tutorial threads because I feel like there should be more discussion in them.

  6. #6
    I have edited the tutorial to mention both cases along with a blurb mentioning my preference for the array literal syntax.

    Great, now even Kirupa is { facebooking | twittering }

  7. #7
    What about the slice and splice functions? Especially the splice function might be of good use when using arrays.
    AS2 / AS3 / JS / JQUERY / (X)HTML / HTML5 / CSS / CSS3 / PHP

  8. #8
    Swooter - I will add that in a revision

    Great, now even Kirupa is { facebooking | twittering }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012