I'm using the svg.js library.
How can we check if a variable x is an instance of SVG class?
I tried:
new SVG(document.createDocumentFragment()) instanceof SVG // false
new SVG(document.createDocumentFragment()).contructor === SVG // false
I'm using the svg.js library.
How can we check if a variable x is an instance of SVG class?
I tried:
new SVG(document.createDocumentFragment()) instanceof SVG // false
new SVG(document.createDocumentFragment()).contructor === SVG // false
Copyright © 2021 Jogjafile Inc.
Checking what value
SVGfunction returns we find that a newelementis created and returned. It is an instance ofSVG.Doc:So, the solution is: