JavaScript Feature Reference: instanceof
Operator Web Browser Support Test
1. Introduction
In this web page there is one web browser JavaScript feature support test: a feature implementation test. The implementation test determines if the web browser recognizes the JavaScript instanceof
operator. The implementation test is a simple test for the presence of web browser support, and a definitive test for the absence of web browser support. If the web browser does not recognize the JavaScript instanceof
operator, the implementation test reports: Fail (no support): The web browser does not recognize the JavaScript
If the web browser recognizes the JavaScript instanceof
operator. The web browser does not support the JavaScript instanceof
operator.instanceof
operator, the implementation test reports: Pass (at least partial/possibly full support): The web browser recognizes the JavaScript
instanceof
operator. The web browser at least partially/possibly fully supports the JavaScript instanceof
operator. Positive determination of full web browser support is beyond the scope of this test.
The web browser support test source code is shown in Section 2.1. The web browser support test source code is run in Section 2.2, which shows the web browser support test result.
1.1. instanceof
Operator Web Browser Support
Pass (at least partial/possibly full support):
IE6+, ED12+, FF1.5+, SF3.1+, CH2+, OP7.50+.
1.2. Abbreviations
- IE = Internet Explorer.
- ED = Edge Legacy 12 - 18 (EdgeHTML based) and Edge 79+ (Chromium based).
- FF = Firefox.
- SF = Safari.
- CH = Chrome.
- OP = Opera.
2. instanceof
Operator Web Browser Support Test
2.1. Web Browser Support Test Source Code
<script>
var booleanLiteral = true,
booleanViaBooleanConstructor = new Boolean(false),
numberLiteral = 1,
numberViaNumberConstructor = new Number(2),
stringLiteral = "abc",
stringViaStringConstructor = new String("def"),
nullLiteral = null,
undefinedLiteral = undefined,
undefinedVariable;
function functionDeclaration(){}
var functionExpression = function(){},
functionViaFunctionConstructor = new Function(),
arrayLiteral = [],
arrayViaArrayConstructor = new Array(),
objectLiteral = {},
objectViaObjectConstructor = new Object();
function CustomConstructor(){}
var objectViaCustomConstructor = new CustomConstructor();
// In IE11, FF59, and CH66, window.instanceof === undefined. In IE8-, FF3 - 3.6.6, and OP8.54-, window instanceof Object === false. In IE9+, FF1.5 - 2.0.0.20, FF3.6.7+, SF3.1+, CH2+, and OP9+, window instanceof Object === true.
if (!(booleanLiteral instanceof Boolean) && !(booleanLiteral instanceof Object) && booleanViaBooleanConstructor instanceof Boolean && booleanViaBooleanConstructor instanceof Object && !(numberLiteral instanceof Number) && !(numberLiteral instanceof Object) && numberViaNumberConstructor instanceof Number && numberViaNumberConstructor instanceof Object && !(stringLiteral instanceof String) && !(stringLiteral instanceof Object) && stringViaStringConstructor instanceof String && stringViaStringConstructor instanceof Object && !(nullLiteral instanceof Object) && !(undefinedLiteral instanceof Object) && !(undefinedVariable instanceof Object) && functionDeclaration instanceof Function && functionDeclaration instanceof Object && functionExpression instanceof Function && functionExpression instanceof Object && functionViaFunctionConstructor instanceof Function && functionViaFunctionConstructor instanceof Object && arrayLiteral instanceof Array && arrayLiteral instanceof Object && arrayViaArrayConstructor instanceof Array && arrayViaArrayConstructor instanceof Object && objectLiteral instanceof Object && objectViaObjectConstructor instanceof Object && objectViaCustomConstructor instanceof Object){
document.write("<p><b>Pass</b> (at least partial/possibly full support): The web browser recognizes the JavaScript <code>instanceof</code> operator. The web browser at least partially/possibly fully supports the JavaScript <code>instanceof</code> operator. Positive determination of full web browser support is beyond the scope of this test.</p>");
} else {
document.write("<p><b>Fail</b> (no support): The web browser does not recognize the JavaScript <code>instanceof</code> operator. The web browser does not support the JavaScript <code>instanceof</code> operator.</p>");
}
</script>