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:
- Ajaxian » Web Inspector: Looking good, and profiling nicely
- smush it!
- cssdoc - Trac
- CSS Systems for writing maintainable CSS | Natalie Downe
- The PNG Gamma Dilemma - Trevor Morris Photographics
Want to buy a cheap laptop for your design work? read laptop reviews at laptopical.com