在Javascript中定义对象类别
(编辑:jimmy 日期: 2026/1/24 浏览:2)
From: JavaEye.com
注意JavaScript中对象类别的定义,使用function来定义对象类别,初始化对象使用new操作符
function Person(name, age) {
this.name = name;
this.age = age;
this.toString = function() {
document.writeln("[name]:"+this.name+"<br>"+"[age]:"+this.age);
}
}
完整的简单HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JavaScript</title>
<script language="javascript" type="text/javascript">
function Person(name, age) {
this.name = name;
this.age = age;
this.toString = function() {
document.writeln("[name]:"+this.name+"<br>"+"[age]:"+this.age);
}
}
</script>
</head>
<body>
<script type="text/javascript">
var person = new Person();
person.name="robbin";
person.age=30;
person.toString();
</script>
</body>
</html>
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。