59.pickNested

Write a function named pickNested that receives 2 parameters:

  • an object - data
  • a string representing a nested path through our data object - path

The function should return the value of the property at the given path. If there is no property at the given path, the function should return undefined.

NOTE: this is similar with the pickFields function but a little bit more complex as it is dealing with nested objects.

Example 1

Input

data

=

path

=

Output

Example 2

Input

data

=

path

=

Output