mortsahl
mortsahl

Reputation: 602

Add to add value to object inside an array

I have an array that contains 1 item. It looks like this ...

[ { one: "one", two: "two" } ]

I want to add to the object so it how looks like this ...

[ { one: "one", two: "two", three: "three" } ]

how do I do that?

Upvotes: 0

Views: 92

Answers (1)

iConnor
iConnor

Reputation: 20189

Basic Javascrpt.

var array = [ { one: "one", two: "two" } ];


array[0].three = 'three';

means, array at index 0 set three to equal"three"

PS: this, nor are you using JSON

Upvotes: 2

Related Questions