/ Published in: JavaScript
                    
                                        
Based on some comments in [StackOverflow Question](http://stackoverflow.com/questions/95875/javascript-check-to-see-if-a-variable-is-an-object "How to check if a variable is an object")
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
if(typeof(foo) !== 'undefined' && foo != null) {
//you can use foo!
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                