菁英数字科技(猩码)-猩码学苑-专注软件开发人才菁英教育

标题: 张建斌-2022-1-10 [打印本页]

作者: IT5353    时间: 2023-2-9 19:45
标题: 张建斌-2022-1-10
递归:  <script>
      //函数的递归
      // 1.在函数内部调用自己叫做递归
      // 2.需要一个出口]满足一定的条件停止调用或者满足一定条件才继续调用
    //   function fn(n){
    //     console.log(n);
    //     if(n>0){
    //         fn(n-1);
    //     }
    //     console.log(n);
    //   }
      function fn(n){
        console.log(n);
        if(n>0){
            console.log(555);

        }
        console.log(n);

      }
      fn(4);
    </script>
es6继承 <script>
        //父类
           class Person{
            //构造函数
            constructor(name,age){
                this.name=name;
                this.age=age;
            }

            //原型方法
            eat(){
                return '吃饭'
            }
            //静态方法
            static way(){
                return '走路'
            }
        }

        //子类
        class Programmer extends Person{

            //构造函数
            constructor(name,age,skill){
                //继承属性
                super(name,age);
                //子类自己属性
                this.skill=skill;
            }

            //原型方法
            code(){
                return '一天一万行'
            }
        }






欢迎光临 菁英数字科技(猩码)-猩码学苑-专注软件开发人才菁英教育 (http://www.xingmaxueyuan.com/) Powered by Discuz! X3.4