Categories

Jul 16, 2019 in JavaScript

Q: How to add/remove properties to object dynamically in Javascript?

1 Answer

Jul 16, 2019

You can add a property to an object using object.property_name =value, delete object.property_name is used to delete a property.

Example:

    let user = new Object();
    // adding a property
    user.name='moni';
    user.age  =12;
    console.log(user);
    delete user.age;
    console.log(user);
Click here to read more about JavaScript
Click here to read more about Insurance

Related questions

Madanswer
Jul 16, 2019 in JavaScript
Jul 16, 2019 in JavaScript
Jul 16, 2019 in JavaScript
...