Ed

Accessing deeply nested data safely is a common challenge. Let's build a utility that handles missing properties gracefully.

Your Task:

  • Create a function get(obj, path, defaultValue)
  • path is a string like "user.profile.name"
  • Navigate through the object following the path
  • Return defaultValue if any part is missing
  • This is similar to lodash's _.get()
TypeScript Solution
Loading...

Submit your code to see test results