SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Alert Array List

    How do you alert a new array list ?

    var people=['dog','cat','house','car','truck','earth'];
    people.push('bold','pepsi','honda');
    people.unshift('Joe');
    people.pop('honda');
    people.splice(1,3);
    alert(people[5]);
    I want a alert of the array list after the pushing,pop'ing and splicing to appear before the alert of which array to display which is alert.people[5].

    ie.
    0 - joe
    1 - dog
    2 - cat
    etc etc giving me the array number as well.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,046
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Code:
    var len = daarray.length;
    for(var i=0;i<len;i++) {
         alert(i + ' = ' + daarray[i]);
    }
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

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