new 关键字

学习过的调用或者是执行函数的方式有几种?数组

①函数名+小括号函数

②事件处理函数学习

③定时器this

④数组里面的元素是函数,枚举出来执行spa

new关键字code

提示:须要注意new 关键字须要在函数名前面使用blog

构造函数是什么?特征有哪些?事件

①函数的函数名首个字母为大写io

②必需要用关键字new调用这个函数console

 function People(name,age) {
             this.name = name;
             this.age = age;
             for(var i = 0 ;i<10;i++){
                  console.log(i);
             }
        } 
      var xiaoming  = new People("小明",13);
      console.log(xiaoming);

相关文章
相关标签/搜索