Setting the key of an object to the value of an variable

msg.payload = myObject('DGWZ_temp_offset');
return null;

function myObject(key){
let value = global.get(key);
return = {key.valueOf():value}; ????????

result should be {'DGWZ_temp_offset':value}

your help is very much appreciated.


return = {[key]: value};
1 Like

Hi Steve,
many thanks!
it works ok :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.