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
SVG
function returns we find that a newelement
is created and returned. It is an instance ofSVG.Doc
:So, the solution is: