I'm trying to toggle a navbar when you click on a button. I've followed an example but my javascript gives an error: caught TypeError: Cannot read property 'display' of undefined at HTMLDivElement.myFunction (script.js:6) myFunction @ script.js:6
The Code:
var myNavigation = document.getElementsByTagName("nav");
var myFunction = function (){
       if (myNavigation.style.display === "none") {
              myNavigation.style.display === "flex"
       } else {
              myNavigation.style.display === "none"
       }
};
myButton.onclick = myFunction;
 
    