Checking for object literals
published 3 October 2006
Such a basic thing to do, but still, I didn’t have to do it until now:
Checking if an object literal is defined.
var my_object_literal
{
'my_property' : 'I exist'
};
if (window.my_object_literal)
{
alert(my_object_literal.my_property);
}
via FAQTS
Comment
Quick links
Other people's articles that we think you might be interested in:
- Tracking Sub Domains with Google Analytics
- Google Webmaster Guidelines
- WordPress Gears
- Using conditional comments to target Outlook 2007 - Campaign Monitor Blog
- ~jk typesafe objects in PHP
Want to buy a cheap laptop for your design work? read laptop reviews at laptopical.com