I have successfully implemented a boostrap 4 navbar, and I have a function that creates links. Is there a more efficient method to accomplish this using JavaScript? I currently have three functions that create links for each hyperlink. Would it be possible to use cookies or any other efficient method with JavaScript?
<script>
function setAboutLink(lang){
var url = lang+"/aboutus";
window.location.href= url;
}
function setContactLink(lang){
var url = lang+"/contact";
window.location.href= url;
}
function setListLink(lang){
var url = lang+"/list";
window.location.href= url;
}
</script>
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-top pb-0">
<a class="navbar-brand" href="/"+selectedLanguageName><img src="/images/logo.png" alt="" class="logoC mr-4"
style="max-width: 100px"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-between" id="collapsibleNavbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="javascript:" onclick="setAboutLink(window.location.href)"
>About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="javascript:" onclick="setContactLink(window.location.href)"
>Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="javascript:" onclick="setListLink(window.location.href)"
>List</a>
</li>
</ul>
</div>
</nav>