public static String typeofName ( Scriptable scope , String id ) { Context cx = Context . getContext ( ) ; Scriptable val = bind ( cx , scope , id ) ; if ( val == null ) return "undefined" ; return typeof ( getObjectProp ( val , id , cx ) ) ; }
The typeof operator that correctly handles the undefined case