javascript - Shortcut for accessing member of an object [, of an object...] -
this question has answer here:
is there short way accessing nested object without checking each parent object?
this throw exception if foo or bar undefined:
var exists = (foo.bar.value !== undefined);
i expect check function like:
var exists = object.exists(foo.bar.value);
is there build-in javascript?
use typeof
if (typeof myobject!= "undefined") { console.log('it exists') }
Comments
Post a Comment