||View All MessagesBack to WebFX|
I was wondering which is the best way of making associative arrays / hashes / dictionaries. I've seen that in standard JS you can do something like this:
var tel = new Array();
This works in Moz/IE.
Looking thru the windows script tecnologies documentation, the array object doesn't mention this feature. Looking a little more I find that in the Script Runtime, MS has put in an ActiveX Dictionary object:
The following code illustrates how to create a Dictionary object:
[JScript] var y = new ActiveXObject("
I've used this object for various tasks, and it's been wonderfull... the only thing that bugged me was the "keys()" method. It returns a VBArray... and you have to cast it to a JS Array like this! (new VBArray(
Now I find that I'm going crossbrowser, and that I might need the hash functionality... So i don't want to use ActiveX. (I suppose Mozilla can not access this object).
What are the tradeoffs of using method 1 (plain arrays) versus method 2? Does anyone know the implementation differences? What's going on internally? I guess the guys in MS are not stupid, and that they have put in the Dictionary for some reason.
Thank you in anticipation.
Jose Luis Martinez