29 - Class Object Type Checks
by steen_hansen
HTML
<!DOCTYPE html><meta charset="utf-8" />
<title id='title-id'>29 Class Object Type Checks</title>
<div id='js-div' style="width:40%; " >
<a href='https://github.com/steenhansen/type-czech' target="_blank" class='git-hub'>GitHub Package</a>
<div id='js-code'>the javascript</div>
</div>
<div id="the-explanation" style="width:60%" >
<div class='an-explantion'>29 - Class Object Type Checks</div>
<div id='explanation-text'>
<br>
Class objects can have their types checked.
The below function shows the object inheritance lineage.
<pre>
type_czech.typeProtos(window)
// Array(4) [ "Window", "EventTarget", "EventTarget", "object" ]
</pre>
<pre>
type_czech.typeProtos(document)
// Array(5) [ "HTMLDocument", "Document", "Node", "EventTarget", "object" ]
</pre>
This is how to get the final object type.
<pre>
type_czech.typeFinal(window)
// "Window"
type_czech.typeFinal(document)
// "HTMLDocument"
</pre>
Finally, you can interogate an object to see if it is an instance of a class.
<pre>
type_czech.typeIsA(document, 'Node')
// true
type_czech.typeIsA(document, 'object')
// true
</pre>
<br>
</div>
<div id="console-log" >
<div class='a-title'>Console Output</div>
<div id='log-text'></div>
<br>
</div>
<br>
<!-- -----------TYPE 1------------------------------- -->
<script src="https://cdn.jsdelivr.net/gh/steenhansen/type-czech@latest/web-resources/consolelog.js"></script>
<script src="https://cdn.jsdelivr.net/gh/steenhansen/type-czech@latest/web-resources/TypeCzech.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/steenhansen/type-czech@latest/web-resources/type-czech.css">
<!-- ------------TYPE 1------------------------------ -->
<div id='js-fiddles'>
<a title="Example-Contents" href="https://jsfiddle.net/steen_hansen/1Lshcept/?Example-Contents" target="_blank">Contents</a>
<a title="00-Readme-Example"...