<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
//prototype和原型链查找
//构造函数
function ren(name, sex, age) {
this.name = name;
this.sex = sex;
this.age = age;
this.shuohua = function() {
console.log();
}
this.zoulu = function() {
console.log();
}
}
//函数的 prototype 可以加隐型属性
ren.prototype.gz = "电工";
//实例化构造方法。
var re = new ren("wulei", "nan", 30);
//函数对象的 __proto__ === 函数的 prototype
console.log(re.__proto__ === ren.prototype);
console.log(re.gz);
</script>
</body>
</html>