open link in new tab using anchor tag code example

Example 1: open link in new tab

<a href="https://www.google.com/" rel="noopener noreferrer" target="_blank">google.com</a>

dont use just target="_blank" without  rel="noopener noreferrer" 
It Makes Your Site Vulnerable to Phishing Attacks

Example 2: html open html in new tab as plain text

document.querySelector("#username").addEventListener('click', function() {
    setTimeout(function() {
		let username = document.querySelector('#username').value;
        window.open("https://www.github.com/" + username, "_blank");
    }, 2000);
}