Facing error : variable is not defined in javascript

I had some variables defined in my javascript, some of which are getting initialized while some are not. 

Now, when I am accessing them for fetching their values, I need to check whether they are initialized or not. If they are not initialized the access to variable will return NULL. But I am not sure how to do that. I am a bit confused, when I tried this


if (!var_name)
   alert("var_name not assigned");


I got an error

ERROR : var_name is not defined.


I had already declared the variable var_name, although i had not assigned it. How to get this work ?