How to edit a array Inside a object

How can I edit an array which is a property of an object. How can I add or remove elements from that array.

Var x= { "array":[1, 34, 'Apple', 'Frog']};


you can access the object property value as x["array"], so you just edit the array x["array"]
for example x["array"][2] is Apple
if you do x.array[2] = "Orange", then it is now Orange

1 Like

You can access it by doing something like x.array , since array is the key name. Then, modify it however you want, like
x.array.push('123')

1 Like

Thanks . It’s that simple :slight_smile: