[英]How to display console.log in HTML
如何在 html 中显示console.log
?
我尝试了很多东西,但无法得到它。
我希望这个out.guild.members.length
显示在 html 中。 有人可以帮助我吗?
谢谢!
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 });
我不太明白你的问题,但如果你想在 HTML 的某个 div 中显示out.guild.members.length
,你可以在 HTML 中添加一个 div。
HTML:
<div id="log"></div>
JS:
document.getElementById("log").innerHTML=out.guild.members.length;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.