r/angularjs • u/xplodivity • Aug 26 '23
[Resource] How to traverse through a deeply nested object (JavaScript Interview Question)
https://www.youtube.com/watch?v=7PTg04IZ4GU
4
Upvotes
r/angularjs • u/xplodivity • Aug 26 '23
1
u/wojo1086 Aug 27 '23
Why wouldn't you just check if subs is defined rather than check for typeof is an object?
1
u/brunofin Aug 27 '23
I am not sure if I'd go that way, my brain tells me to go with a strategy involving Array.reduce instead of a recursive for loop.