enhanced typeof machinery for JavaScript