I am using this code to check undefined variable but it\'s not working.
It actually is working, but there is difference between null and undefined. You are actually assigning to uemail, which would return a value or null in case it does not exists. As per documentation.
For more information about the difference between the both of them, see this answer.
For a solution to this Garfty's answer may work, depending on what your requirement is. You may also want to have a look here.