Go ProSign in

This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Safely inspect nested objects with Reduce

A common problem when dealing with some kinds of data is that not every object has the same nested structure. luke_skywalker.parents.father.is_jedi works, but anakin_skywalker.parents.father.is_jedi throws an exception, because anakin_skywalker.parents.father is undefined. But we can reduce a path to provide safe default values and avoid exceptions when walking the same path on non-homogenous objects - watch to learn how! :)

You must be a Member to view code