function
Student(name,age,id) {
this.name = name;
this.age = age;
this.id = id;
alert(student.name);
alert(student.age);
this.name = name;
this.age = age;
this.id = id;
}
alert(student.name);
alert(student.age);
alert(student.id);
简单吧。
本文介绍了一个简单的JavaScript函数,用于创建一个表示学生的对象。该对象包含姓名、年龄和ID三个属性,并通过实例化演示了如何使用这个构造函数。
225

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



