如何打印JavaScript对象的内容?
要打印JavaScript对象的内容,可以尝试运行以下代码。在这里,使用new关键字创建对象-
示例
<!DOCTYPE html><html>
<body>
<p id="test"></p>
<script>
var dept = new Object();
dept.employee = "Amit";
dept.department = "Technical";
dept.technology ="C++";
document.getElementById("test").innerHTML =
dept.employee + " is working on " + dept.technology + " technology.";
</script>
</body>
</html>
以上是 如何打印JavaScript对象的内容? 的全部内容, 来源链接: utcz.com/z/322004.html