面试官:知道原型吗?
我:知道!
面试官:给我讲讲吧
我:…
1.原型的定义和过程 输出为deng
<!DOCTYPE html>
<html lang="en">
<head>
<title>修炼之路</title>
<meta charset="utf-8">
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
Person.prototype.lastName = 'deng';
function Person () {
//执行 隐式 三部曲、
// 1.定义 var this = {
// 2. __proto__ : Person.prototype
// 3.执行this且向上寻找 父辈的prototype
//}
}
var person = new Person();
console.log(person.lastName);
</script>
</body>
</html>