-1

I need to get rid of prototype from a site so I need to convert this:

var moduleCodeHash = new Hash();
moduleCodeHash.set('SHIPMANAGER','SHIPMENTFILTER');
moduleCodeHash.set('TRAFFICMGR','TRAFFICMGRFILTER');
moduleCodeHash.set('SHIPBIDMONITOR','BIDFILTER');

moduleCodeHash.get(selectedValue);

to plain js or jquery

1

1 Answer 1

1

If you're not doing anything fancy with it then don't make it fancy, use an ordinary object.

var moduleCodeHash = {};
moduleCodeHash['SHIPMANAGER']    = 'SHIPMENTFILTER';
moduleCodeHash['TRAFFICMGR']     = 'TRAFFICMGRFILTER';
moduleCodeHash['SHIPBIDMONITOR'] = 'BIDFILTER';

moduleCodeHash[selectedValue]; // get selectedValue
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.