React.js
Angular
Ethical Hacking
Agile
AWS
BlockChain
Cassandra
Cloud
Salesforce
Scaled Agile
TOGAF
DevOps
GIT
Jenkins
Jira
Kibana
Linux
NGINX
Ansible
Artificial Intelligence
in JavaScript by
How to add/remove properties to object dynamically in Javascript?
Click here to read more about DevOps

1 Answer

0 votes
by

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);

Related questions

Madanswer
+1 vote
asked Jul 16, 2019 in JavaScript by Indian
+1 vote
asked Jul 16, 2019 in JavaScript by Indian
...