Because null
and undefined
are not objects in JavaScript, I guess it could be a global helper function?
Example usage could be something like:
var a = { b: { c: { d: 'hello world!' } } };
tryPath(a, 'b', 'c', 'd'); // returns 'hello world!'
tryPath(a, 'x', 'c', 'd'); // returns undefined