Array Problem

Discussion in 'JavaScript' started by fireflyproject, Oct 16, 2007.

  1. #1
    I have an array:
    menu_links = ['?page=home_content', ['?page=steaks_about', '?page=steaks_about', '?page=steaks_recipe', '?page=steaks_sauce'], ['?page=potatoes_about', '?page=potatoes_about', '?page=potatoes_recipe'], ['?page=asparagus_about', '?page=asparagus_about', '?page=asparagus_recipe'], '?page=feedback'];


    Now, the way it looks to me, there are array's inside this array... how would one pull out seperate pieces of the inner ones? The way this array is set up is not something I have the ability to change, so I have to work with it this way. Any thoughts?
     
    fireflyproject, Oct 16, 2007 IP
  2. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    To make it easier for you to see, let me use a different content of the array and format slightly differently:

    menu = [
       'rice',
       ['spaghetti', 'fettuccine', 'penne'],
       'noodles',
       ['water', 'orange juice', 'coke']
    ];
    Code (markup):
    The contents of the array are:
    menu[0] => 'rice'
    menu[1] => the array ['spaghetti', 'fettuccine', 'penne']
    menu[1][0] => 'spaghetti'
    menu[1][1] => 'fettuccine'
    menu[1][2] => 'penne'
    menu[2] => 'noodles'
    menu[3] => the array ['water', 'orange juice', 'coke']
    menu[3][0] => 'water'
    menu[3][1] => 'orange juice'
    menu[3][2] => 'coke'
     
    phper, Oct 17, 2007 IP
  3. fireflyproject

    fireflyproject Active Member

    Messages:
    969
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Oh! Thanks. I had no idea you could add the latter thing onto it. Thanks!
     
    fireflyproject, Oct 17, 2007 IP