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

Popular posts from this blog

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -

ios - Align baselines with characters in large line heights with Text Kit -