Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Can't quite figure out how to take array from JS file to HTML

I am using discord API to get all information about users and their guilds. But when I filter all information I need and try to show it on frond end of my aplication. It show as: Object, object , I was trying to do this for a long time, and it confuses me a lot. Please help. Thank you

I am using express.

HTML Code:


<head>
   <meta charset="UTF-8">
</head>
<style>
   #body {
      text-align: center;
      margin-top: 100px;

   }

   #h1info {
      color: black;
      font-family: Arial;
   }

   #guild {
      color: black;
      font-family: Arial;
   }

   #b1 {

      background-color: white;
      height: 80px;
      border: 2px solid black;
      border-radius: 30px;
      width: 70%;
      text-align: left;
      padding: 15px 15px;
      margin-top: 10px;
   }
</style>

<body id="body">
   <img src="https://cdn.discordapp.com/avatars/<%=id%>/<%=avatar%>">
   <H1 id="h1info">Username: <%=username%><br>ID: <%=id%>
   </H1>

   <br><br>

   <script>


      var guildsLength = '<%=guildsLength%>';
      var guilds = '<%=guilds%>';




      document.addEventListener('DOMContentLoaded', function () {

         for (var i = 0; i < guildsLength; i++) {


            var button = document.createElement('button');
            button.type = 'button';
            button.innerHTML = guilds;
            button.className = 'btn-styled';
            button.id = 'b1'

            button.onclick = function () {
               // …
            };

            document.body.appendChild(button);

         }

      }, false);
   </script>


</body>


</html>

My array looks like this:

[
  { name: '👻 • Ghost Community', id: '920369960419721267' },
  { name: 'KAROVICH', id: '951578230496850021' },
  { name: 'BOTTESTER V2', id: '977826403221385277' }
]

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!