Why insertAdjacentHTMLis not working

HTML


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <nav class="navbar">
      <ul class="nav-menu">
        <li class="nav-menu-item"><a href="./index.html">Home</a></li>
        <li class="nav-menu-item">
          <a href="./writeblogs/writeblogs.html">Write Blogs</a>
        </li>
        <li class="nav-menu-item">
          <a href="./contactus/contactus.html">Contact Us</a>
        </li>
      </ul>
      <button class="btn login-btn">
        <a href="./login/login.html">Login</a>
      </button>
      <button class="btn register-btn">
        <a href="./register/register.html">Register</a>
      </button>
    </nav>
    <h1>Blogs</h1>
    <div id="container">
      <h3 class="blog-title">Blog Title</h3>
      <p class="blog-description">Description</p>
    </div>
    <script src="index.js"></script>
  </body>
</html>


Javascript

const blogTitle = document.querySelector(".blog-title");

const blogDescription = document.querySelector(".blog-description");
const body = document.getElementsByTagName("body");
const container=document.getElementsByClassName("container")


fetch("https://node-js-app-with-auth.herokuapp.com/api/blogs")
  .then((res) => res.json())
  .then((data) => {
     const result=
     data.map(ele=>createHTML(ele))
console.log(result.join(","))
     container.insertAdjacentHTML
     
     ("beforeend",result.join(","))
   
  })
  .catch((err) => console.log(err));

const createHTML = function (item) {
  return`<h3>${item.title}</h3>
    <h3>${item.author}</h3>
    <p>${item.body}</p>`;
    
};

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.