|
-
November 19th, 2008, 07:27 PM
#1
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.
-
November 19th, 2008, 07:58 PM
#2
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.
-
November 19th, 2008, 08:44 PM
#3
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.
-
November 19th, 2008, 11:33 PM
#4
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.
-
November 22nd, 2008, 09:03 AM
#5
Re: array map in javascript
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|