Skip to main content

get

_.get(path, object) # Ⓢ [Ⓣ][1] Ⓝ

Gets the value at path of object. If the resolved value is



undefined, the defaultValue is returned in its place.

Since​

3.7.0

Arguments​

  1. path (Array|string): The path of the property to get.
  2. object (Object): The object to query.

Returns​

(*): Returns the resolved value.

Example​

var object = { 'a': [{ 'b': { 'c': 3 } }] };

_.get('a[0].b.c', object);
// => 3

_.get(['a', '0', 'b', 'c'], object);
// => 3

_.get(['a.b.c', 'default'], object);
// => 'default'