5-4编程练习,这样可以吗
来源:5-4 编程练习
田马达加斯加
2018-11-07 11:19:47
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>5-4</title>
</head>
<body>
<script>
function information(){
var student={
name:'张宇',
sex:'男',
age:18
};
this.getStudent=function(){
return student;
}
}
var a=new information();
var b=a.getStudent();
console.log(b);
//补充代码
</script>
</body>
</html>
1回答
这段代码只是返回了定义的对象,并没有进行设置,另一个问题中代码是正确的哦,已经在问题中回复,可以查看一下:http://class.imooc.com/course/qadetail/75857
祝学习愉快!
相似问题