Published on InterSystems Developer Community (https://community.intersystems.com)

Home > cache/iris class array approach analogue to javascript Associative array

Question
Emanuel Lazar · Apr 30, 2021

cache/iris class array approach analogue to javascript Associative array

objects in javascript :

var oM = new Object;

var mMode=["down","up","click"] ;
var key,val ;
    for (key in mMode)
    {

       val = mMode[key] ;
        oM[val]={} ;
        oM[val].id   ="" ;
        oM[val].type ="" ;

       ...

 }

so I can access the .type directly as :

oM.down.type

or:

oM["down"].type

what is the syntax in CACHE or IRIS, to achieve such approach via class/key/property...?

acctually: class/object/key/property anlaogue to ^GLOBAL(key,"property")=val

#Caché

Source URL:https://community.intersystems.com/post/cacheiris-class-array-approach-analogue-javascript-associative-array