Whenever the user clicks on the menu bar icon at the top right corner of the page, the display property of the navigation links should toggle between none and block. Two global variables are utilized in this process - one for the menu button (to detect clicks) and one for the ul element (to control its display property).
var menuButton = document.getElementById("menuicon");
var menu = document.getElementById("navlink");
function handleMenuClick() {
if (menu.style.display == none) {
menu.style.display = "block";
} else {
menu.style.display = "none";
}
}
menuButton.addEventListener("click", handleMenuClick);
...and so on...