Timeline for Getting path array for given value in nested Object
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 29, 2017 at 13:08 | vote | accept | Cold_Class | ||
Jun 16, 2017 at 6:36 | comment | added | Cold_Class |
I mixed return types because this way I could check the outcome simply with if(result) instead of something like if(result.length>0) - is there a downside to that mixed return? - I'm not sure why I needed hasOwnProperty but I used to get an error sometimes without it so I kept it there over time. I always have a hard time following what is happening in recursion - your search is doing that (truly), right? The if(found) break; is one of those things we need to stop the recursion smoothly once we find the value, right? Without it the result array would probably become very long?
|
|
Jun 15, 2017 at 21:17 | history | edited | Mike Brant | CC BY-SA 3.0 |
deleted 1 character in body
|
Jun 15, 2017 at 21:12 | history | answered | Mike Brant | CC BY-SA 3.0 |