<!DOCTYPE html>
<html>
<body>
<script>
person=new Object();
person.firstname="Bill";
person.lastname="Gates";
person.age=56;
person.eyecolor="blue";
document.write(person.firstname + " is " + person.age + " years old.");
</script>
</body>
</html>JavaScript创建对象
本文展示了一个使用JavaScript创建对象并设置属性值的基本示例,包括姓名、年龄和眼睛颜色等信息,并通过document.write方法输出对象属性。

被折叠的 条评论
为什么被折叠?



