I wonder how I can write the jQuery is method using only javascript?
You can’t use any third party libraries. Only the javascript provided from the browser.
FYI the method is in jQuery:
Check the current matched set of elements against a selector, element,
or jQuery object and return true if at least one of these elements
matches the given arguments.
If you need support for older browsers, you should use jQuery. This should work in IE9, Firefox and Chrome.