JS之代理模式

时间:2024-09-22 13:34:56
 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
//1,买家
function maijia (argument) {
// body...
this.name = '小明'
} //2.中介
function zhongjie(){
zhongjie.prototype.maifang = function(){
new fangdong(new maijia()).maifang('20W');
}
}
//
function fangdong(maijia){
this.maijia_name = maijia.name;
this.maifang = function (monney) {
// body...
alert('拿到了'+this.maijia_name+monney)
}
}
(new zhongjie).maifang();
//=== var a = new zhongjie();a.maifang(); </script>
www.alloyteam.github.io
</body>
</html>