public static String typeof ( Object value ) { if ( value == null ) return "object" ; if ( value == Undefined . instance ) return "undefined" ; if ( value instanceof ScriptableObject ) return ( ( ScriptableObject ) value ) . getTypeOf ( ) ; if ( value instanceof Scriptable ) return ( value instanceof Callable ) ? "function" : "object" ; if ( value instanceof CharSequence ) return "string" ; if ( value instanceof Number ) return "number" ; if ( value instanceof Boolean ) return "boolean" ; throw errorWithClassName ( "msg.invalid.type" , value ) ; }
The typeof operator