The iselement()
function from the Underscore library allows you to determine if a given value is a DOM Element. To use this function, you first need to include the Underscore library in your project. Once that is done, you can use _.isElement()
like this:
index.tsx307 chars11 lines
In the above example, we first import the Underscore library using the require()
function (assuming we are using a CommonJS module system). We then define a variable myElement
that contains a DOM element with the ID my-element
. Finally, we call _.isElement()
with myElement
as an argument and store the result in a variable called isElement
. We then log the value of isElement
to the console, which should print true
.
gistlibby LogSnag