0

This is what I do today

    if (slot=="BARDAY") {
        adActiveTable = global.ad_BARDAY[0];
    } else if (slot=="FRONT") {
        adActiveTable = global.ad_FRONT[0];
    } else if (slot=="RIGHT") {
        adActiveTable = global.ad_RIGHT[0];
    } else if (slot=="TOPLIST") {
        adActiveTable = global.ad_TOPLIST[0];
    }

(etc... I got a LOT of them)

My queston is, why doesnt this work?

    adActiveTable = global.ad_[slot][0];

(that solution gives "Cannot read property 'FRONT' of undefined" if e.g. the slot is = "FRONT")

I even tried this

    adActiveTable = global.ad_[slot];

And still same error??

Is there no better way to do this? (no eval() please) :-)

torbenrudgaard
  • 2,375
  • 7
  • 32
  • 53

0 Answers0