At startup:
if (data.custaccount.webaddress) {
alert('found it');
}
I get an error
data.custaccount is undefined
The only way I can get around this seems to be with multiple IFs, for example:
if (undefined != data && undefined != data.custaccount && undefined != data.custaccount.webaddress) {
alert('found it');
}
Is there any way to make this easier?
In php, we usually used isset (data.custaccount.webaddress), and this worked pretty well. is there an equivalent in javascript (or jquery)?
We used try / catch, but found to slow down the performance of the script significantly.
I saw someone else ask for something like this at http://verens.com/2005/07/25/isset-for-javascript/ without any success, but I hope stackoverflow will make this work normally save the day :)
Thank!!!
Justin
source
share