Lots of stuff isn't possible with JavaScript in the average browser. I'm 97% certain that this is one of them. What you could do is write a small script on your server that does this lookup, or use ActiveX, Flash or Java to run nslookup
on the client machine.
You could also use Cloudflare's DNS over HTTPS for this purpose. (Other DNS over HTTPS providers exist.) It's the same as the server technique, except somebody else has already done it. See this webpage for full details, but here's an example request URL:
https://cloudflare-dns.com/dns-query?name=example.com&type=TXT
Other DNS over HTTPS providers are available; for instance, here is the list of providers available in Firefox. I strongly recommend running your own server, instead of using one of these providers, if at all possible – it's significantly better for your users' privacy.