Skip to content

Function_evisit_core_js_utils_get

Wyatt Greenway edited this page Jan 31, 2017 · 4 revisions

function get(obj, path[, defaultValue])

Parameters

  • obj
    • (Object) >>> Object to get property from
  • path
    • (String) Dot notation path to evaluate
  • defaultValue [optional]
    • (*) Specify a default value to return if the requested property is not found, is null, undefined, NaN or !isFinite

Return value

  • (*) Return property specified by path

Description

See Also

Examples

var obj = {hello: {world: "!!!"}, arr:[[1,2],3,4,5]};
utils.get(obj, 'hello.world'); //!!!
utils.get(obj, "some.key.that.doesn't.exist", 'not found'); //not found
utils.get(obj, "arr[0][0]"); //1
utils.get(obj, "arr[1]"); //3

Clone this wiki locally