Languages
[Edit]
EN

JavaScript - set object property by path

7 points
Created by:
Kadeem-Craig
516

In this article, we would like to show you how to set object property by the path in JavaScript

In the below example, we create a function that takes three arguments:

  • object that we modify,
  • path to the property in the object (delimited by '.'),
  • value that is set under the specified path.

With the function, we can create new object properties and specify their value or override existing ones.

 

Practical example

Edit

 

See also

Edit
  1. JavaScript - get object property by path 
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join