js 类

---恢复内容开始---

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
</head>
<body>

    <script>
    
    People.prototype  ={
        x:100,y:200,z:function(){alert(300);}
        
    } ; //上一级
    
    
        function People(name,age){
            this.name= name;
            this.age = age;
            
        }  //
    
    var people = new People("张三",28);  //构造函数
    
    people.z();
    
    //alert(people.);

构造函数

 

posted @ 2019-04-27 20:24  aladam  阅读(110)  评论(0编辑  收藏  举报