L
L
Leo2014-05-01 18:44:29
In contact with
Leo, 2014-05-01 18:44:29

How to insert a variable into the key name of a VkScript object?

If we execute the code

var a = {"cname":456};
var parametr = 12331;
a = a + {"name":123, "lol":76478167};
a = a + {parametr: 222};
return a;

Get
response: {cname: 456, name: 123, lol: 76478167, parametr: 222}

I need the result to be like this:
response: {cname: 456, name: 123, lol: 76478167, 12331: 222}

You need to insert the parametr variable into the key name. How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WTFRU7, 2014-05-14
@WTFRU7

var arr = {};
arr.field = "key";
return arr;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question