Using ES6 arrow functions, you can call that helper function with a one-line callback (or more accurately, a closure) function that just returns the property you want. function getSafe(fn) { try { return fn(); } catch (e) { return undefined; } } // use it like this getSafe(() => obj. a. lot