You can also read,
Let’s just create a script and use document.write() function to echo out HTML.
See the below example,
You can see that I have used a variable to put the URL string in href. You can put the URL directly in document.write(). But as I am giving you an example, that’s why I have used a variable. Here the plus operator is used to concate my variable string with the HTML tag.