1

I would like to use the same function in XPages via Javascript.

Dim firstList List As Double
Dim secondList List As Double 

firstList("any")= 0 
firstList("many")= 2 
firstList("work")= 23 

Any suggestion is appreciated.
Regards
Cumhur Ata

Per Henrik Lausten
  • 21,331
  • 3
  • 29
  • 76
Cumhur Ata
  • 809
  • 6
  • 18

2 Answers2

4

Use a JavaScript object:

Initialize object with

var firstList = {any:0, many:2, work:23};

or

var firstList = {};
firstList.any = 0;
firstList.many = 2;
firstList["work"] = 23;

Get an entry value with

var anyNumber = firstList.any;
var manyNumber = firstList["many"];
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
3

If you want to do this in server-side JavaScript you can use a HashMap and do something like this:

var firstList = new java.util.HashMap();
firstList.put("any", 0 );
firstList.put("many", 2);
firstList.put("work", 23);

You can then use firstList.get(key) to get the value.

Per Henrik Lausten
  • 21,331
  • 3
  • 29
  • 76