Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/09/2019 in all areas

  1. 1 point
    Other than what I described? I'm sure you could come up with something that is more complex, but I don't know why you would. If you're looking for a built-in recursive object key search, I don't believe there is one. You would need to roll your own.
  2. 1 point
    If you're talking about Array.map, that's only available on arrays, not Objects. Maybe you can convert an Object to an array, but regular Objects don't have a map method. You can return the keys of an object though and loop through them that way. It sounds like you need a recursive function that checks if you're dealing with an array or object and searches appropriately. It would call itself if it found another array or object.
  3. 1 point
    It's correct to wrap property names in quotes in Javascript. JSON stands for "JavaScript Object Notation", after all. If the JSON is in a string as when returned by AJAX, you need to use JSON.parse() to read it, but if you can just have the JSON right in the code itself, you won't need to parse it.
×