how to check if an object exists in javascript -


i want check if window.sessionstorage object exists. way it:

if (window.sessionstorage) 

in javascript?

if(sessionstorage.length == 0) {     //do } 

that validate whether sessionstorage empty or not. alternatively, can use this:

if(typeof(sessionstorage) == 'undefined')  {     //do } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -