HEYHEY
HEYHEY

Reputation: 533

Adding values to object in js

So, I have the following js object structure:

enter image description here

I am trying to add a value to this, for example, "234324" after "ewerewr".

I tried obj["d7vi"] = new_value;

But it gets rid of all the previous values.

Any help?

Upvotes: 0

Views: 171

Answers (1)

gurvinder372
gurvinder372

Reputation: 68393

make it

obj["d7vi"].push(newValue);

you need to add to the array rather than replace its existing values.

Upvotes: 5

Related Questions