Click to See Complete Forum and Search --> : array map in javascript
cj-wijtmans
November 19th, 2008, 06:27 PM
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
PeejAvery
November 19th, 2008, 06:58 PM
Maps don't exist in JavaScript. You can use objects, which are similar, but not the same.
cj-wijtmans
November 19th, 2008, 07:44 PM
hmm well... what do u suggest me... i reallyy have no clue
nvm
var mop = Object();
mop[key] = val;
PeejAvery
November 19th, 2008, 10:33 PM
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.
var mop = {}; // object
var mop = []; // array
cj-wijtmans
November 22nd, 2008, 08:03 AM
thanks for the advice
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.