CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2008
    Location
    Netherlands
    Posts
    77

    array map in javascript

    Hi, im not sure of this one. I want to have a map in javascript. or does it already exist.

    i have an array of STR1:STR2
    i must access the array using STR1 and find STR2 in that array.
    so thats a map<string, map<string, string>>.

    thanks. i have no clu on this one
    Last edited by cj-wijtmans; November 19th, 2008 at 07:34 PM.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: array map in javascript

    Maps don't exist in JavaScript. You can use objects, which are similar, but not the same.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Nov 2008
    Location
    Netherlands
    Posts
    77

    Re: array map in javascript

    hmm well... what do u suggest me... i reallyy have no clue

    nvm

    Code:
    var mop = Object();
    mop[key] = val;
    Last edited by cj-wijtmans; November 19th, 2008 at 09:27 PM.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: array map in javascript

    You might want to use the object literals instead. But, if you are just looking for key -> value assignments, you can use associative arrays instead of objects.

    Code:
    var mop = {}; // object
    var mop = []; // array
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Nov 2008
    Location
    Netherlands
    Posts
    77

    Re: array map in javascript

    thanks for the advice

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured