how to figure if a variable is defined, or if its empty in javascript