改变数据原型上的方法
内置类的原型上的方法可以被修改,但是不能被重构
Array.prototype.pop = function(){
console.log(666);
}
var ary = [1,2,3,4];
ary.pop();
console.log(ary)
函数的三种角色
- 普通函数
- 形参实参
- this
- return
- 作用域
- 变量
- 类
- new
- 类
- 实例
- this
- 原型
- 原型链
- proto
- 对象
- 属性名
- 属性值
function Person(name,age=23){
this.name = name;
this.age = age;
}
Person(); //普通函数
var a = new Person(); //类
Person.qqq = 123; //对象