How can I display console.log
in html?
I tried many things but can't get it.
I want this out.guild.members.length
to display in html.
Someone can help me?
Thanks!
let url = 'MyURL';
fetch(url)
// Send an HTTP request to the API using fetch.
.then(res => res.json())
// Parse the data as JSON.
.then((out) => {
console.log(out.guild.members.length);
// Retrieve the member count.
})
.catch(err => { throw err });
CodePudding user response:
i'm not quite getting your question
but if you want to display out.guild.members.length
in some div in HTML you can add a div inside your HTML.
HTML:
<div id="log"></div>
JS:
document.getElementById("log").innerHTML=out.guild.members.length;