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']};
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
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')
Thanks . It’s that simple 