my.prop == null
This comparison is true either if the my.prop property does not exist or if it does exist but contains the value null. Since both null and the undefined value indicate an absence of value, this equality is often what we want. However, if you truly must distinguish between a null value and an undefined value, use the === identity operator or the typeof operator (see Chapter 5 for details).
If you are not sure that your implementation has the undefined variable, you can simply declare your own:
By declaring but not initializing the variable, you assure that it has the undefined value. The void operator (see Chapter 5) provides another way to obtain the undefined value.
Copyright © 2003 O'Reilly & Associates. All rights reserved.