Home > Software engineering >  Adding property to object with node.js
Adding property to object with node.js

Time:12-04

Im trying to add a property to a JSON object in NODE.

Im doing as I do with angular:

 APIresponse.membershipData.dependents[i].age=age;

But it is not working, its just not adding the property.

Is the syntax different in Node?

Thanks.

CodePudding user response:

Try

APIresponse.membershipData.dependents[i]["age"]=age;
  • Related