I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)?  For example:  var data = {     code: 42,     items: [{         id: 1,         name: 'foo'...
I have a data structure like this :  var someObject = {     'part1' : {         'name': 'Part 1',         'size': '20',         'qty' : '50'     },     'part2' : {         'name...
If I have a reference to an object:  var test = {};   that will potentially (but not immediately) have nested objects, something like:  {level1: {level2: {level3: "level3"}}};   What is the best way to check for the existence of property in...
I have a question concerning how the "this" pointer is treated in a nested function scenario.    Say I insert this following sample code into a web page. I get an error when I call the nested function "doSomeEffects()".  I checked i...
I have a flat json file structure like:  [  { "name" : "ABC", "parent":"DEF", "relation": "ghi", "depth": 1 },  { "name" : "DEF", "parent":"null", "relation...
I am looking for a nice solution to access a property by string value, but if the property does not exist it should create it. If the root structure already has defined some parts of the structure, the attributes should not be overwritten, but merged...
I've been struggling to find/build a recursive function to parse this JSON file and get the total depth of its children.  The file looks something like this:  var input = {     "name": "positive",     "children": [{...
Is it possible to have nested JavaScript template tags e.g.  <script id="Product" type="text/html">     <div class="product">         ....         <div class="features">             <script id="...
I'm sure there's a really simple elegant way to do this but I can't quite figure it out.  I have some input data that looks like this:  [ {id: 1, name: "Peter"}, {id: 2, name: "Paul", manager: 1}, {id: 3, name: "Mary&#...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.