I am trying to create collapsed navbar I did the HTML and CSS part but when I do the javascript part it gives me an uncaught reference error. My code is below I provided the HTML CSS and Javascript. I would appreciate it if someone can please help. Thank you in advance. I provided all the code below.

```
<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="UTF-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link

      href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;1,100&display=swap"

      rel="stylesheet"

    />

    <link rel="stylesheet" href="style.css" />

    <title>Document</title>

  </head>

  <body>

    <header>

      <img src="logo/logo.png" alt="" />

      <div class="container" onclick="btnOpen()">

        <div class="line-1"></div>

        <div class="line-2"></div>

        <div class="line-3"></div>

      </div>

      <nav>

        <ul>

          <a href="javascript:void(0)" class="closebtn" onclick="closeNav()"

            >&times;</a

          >

          <li><a href="index.html">Home</a></li>

          <li><a href="pages/about.html">About us</a></li>

          <li><a href="pages/contact.html">How to reach me</a></li>

          <li><a href="pages/portfolio.html">Portfolio</a></li>

        </ul>

      </nav>

      <section class="sm">

        <a href="#"><i class="fab fa-facebook-f" class="facebook"></i></a>

        <a href="#"><i class="fab fa-twitter" class="twitter"></i></a>

        <a href="#"><i class="fab fa-google" class="google"></i></a>

      </section>

      <main></main>

      <section></section>

      <footer></footer>

    </header>

  </body>

  <script src="js/script.js"></script>

  <script

    src="https://kit.fontawesome.com/dd4d991431.js"

    crossorigin="anonymous"

  ></script>

</html>

* {

  box-sizing: border-box;

}

header {

  width: 100%;

  background-color: #e1e1e1;

}

header img {

  width: 100px;

  height: 100px;

}

header .container {

  display: inline-block;

  float: right;

}

.container .line-1,

.line-2,

.line-3 {

  width: 35px;

  height: 5px;

  background-color: #111;

  margin: 6px 0;

}

nav {

  display: flex;

  position: absolute;

  top: 100;

  right: 0;

  background-color: #e1e1e1;

  width: 40vw;

  height: 30vh;

}

nav .closebtn {

  position: absolute;

  top: 0;

  right: 25px;

  font-size: 36px;

  margin-left: 50px;

  text-decoration: none;

  color: #111;

}

nav ul {

  display: flex;

  flex-direction: column;

  align-items: center;

}

nav ul li {

  margin: 10px;

}

nav ul li a {

  text-decoration: none;

  color: #111;

  font-style: bold;

  font-weight: 600;

  font-size: 15px;

  font-family: Roboto;

}

function openBtn() {

  document.getElementsByName("nav").style.width = "40vw";

  document.getElementsByName("nav").style.height = "30vh";

}

openBtn();

function closeNav() {

  document.getElementsByName("nav").style.width = "0";

  document.getElementsByName("nav").style.height = "0";

}

closeNav();

```