More accurate typeof function

Correctly report the type of null, undefined, and anonymous objects.