Share this blog!

How to add attributes to specified place in a JavaScript Object



As a requirement in my internship project (as described in this post), I had to insert new attributes to the JSON schema to a specified location, ie, to add an immediate sibling to the clicked node. Since JavaScript is an unordered list of properties, typical JSON methods could not be used. Therefore a solution where iterating over the keys and cloning them to a new object was used.

The sample code is as follows: 
Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment