d = {color:"red",height:"5",age:"200",shape:"square"}
given a dictionary, I can get a value with Lodash's _.get like so:
var myval = _.get(d, "height",null);
But, can I set the default to another _.get? Like this:
var myval = _.get(d, "length",_.get(d, "height",null));
Thanks for any insight!
Yes.
d = { color: "red", height: "5", age: "200", shape: "square" }
// Object { color: "red", height: "5", age: "200", shape: "square" }
_.get(d, 'hello', _.get(d, 'height', null));
// "5"