In Mirth 3.9.1
This works fine:

Code:
  var dataObj = { };
  var testKey='testKey';
  dataObj[testKey] = 'testValue';
...