C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.hasInstance PropertyThe JavaScript Symbol.hasInstance is used to determine if a constructor object recognizes an object as its instance. Syntax
[Symbol.hasInstance] (obj) Parameters
An object as one of the constructor. Return valueReturn true if the value is in the chain of an object, otherwise false. Browser Support
Example 1<script> //JavaScript to illustrate Symbol.hasInstance var JavaTpoint = [12,45]; document.write( Array[ Symbol.hasInstance ](JavaTpoint) ); //expected output:true </script> Output: true Example 2
<script>
//JavaScript to illustrate Symbol.hasInstance
//Using user define function
function JavaTpoint()
{}
var Script = new JavaTpoint
document.write( JavaTpoint[ Symbol.hasInstance ](Script) );
//expected output:true
</script>
Output: true.
Next TopicJavaScript Symbol
|