+ 2

How would you add a property to a list of properties without having to manually rewrite it at it's core?

How would you add an object to a list of objects Example: var p1 = {"Name": "Bryan", "Age": 12} /*Now I want to add the property "Race" without having to manually do it... How would I do that?*/

9th Oct 2017, 9:01 PM
Bryan
Bryan - avatar
1 Respuesta
+ 7
I think you can just do p1.property = value, this should add a new property if it's new in the object.
13th Oct 2017, 5:58 AM
The Coding Sloth
The Coding Sloth - avatar