Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
The following table summarizes the possible return values of typeof. For more information about types and primitives, see also the JavaScript data structure page.
All constructor functions called with new will return non-primitives ("object" or "function"). Most return objects, with the notable exception being Function, which returns a function.
All constructor functions called with new will return non-primitives ("object" or "function"). Most return objects, with the notable exception being Function, which returns a function.
Need for parentheses in syntax
The typeof operator has higher precedence than binary operators like addition (+). Therefore, parentheses are needed to evaluate the type of an addition result.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Interaction with undeclared and uninitialized variables
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
typeof works with undeclared identifiers, returning "undefined" instead of throwing an error.
Exceptional behavior of document.all
All current browsers expose a non-standard host object document.all with type undefined.
Exceptional behavior of document.all
All current browsers expose a non-standard host object document.all with type undefined.
Exceptional behavior of document.all
All current browsers expose a non-standard host object document.all with type undefined.
This page was last modified on May 22, 2026 by MDN contributors.