javasrcipt中型知识点
2020-08-09 17:54
63 查看
面向对象原型继承
类:模板 对象:具体的实例 在javascript中类与模板用到了极致 原型: var student={ name:'caofeng', run:function (){ console.log(this.name+"run....."); } }; var xiaoming={ name:'xiaoming' }; //小明的原型是student xiaoming._proto_=student;
class 继承
class关键字实在es6引入的 定义一个类,属性和方法 class student{ constructor(name) { this.name=name; } hello(){ alert('hello'); } } let xaioming=new student("xiaoming"); 继承 class student{ constructor(name) { this.name=name; } hello(){ alert('hello'); } } class xaiostudent extends student{ constructor(name,grade) { super(name); this.grade=grade; } run(){ alert(this.name+"删除跑路"); } } let xaioming=new student("xiaoming"); let xioahong=new xaiostudent("xiaohong",1);
相关文章推荐
- JavaSrcipt的三种函数定义方法
- javasrcipt屏蔽功能
- concat综合大全(Javasrcipt和mysql中的用法)
- javasrcipt面向对象编程
- JavaSrcipt如何修改系统默认方法
- 用Javasrcipt写一个计算器的小程序[代码]
- javasrcipt 常用属性,方法
- 关于javaSrcipt错误处理机制
- Javasrcipt时间相关函数
- 第一个JavaSrcipt例子
- javeee项目的css、javascript不能引入,设置的样式不起作用,写的javasrcipt或jquery函数调用不了等问题出现的原因和解决方法
- Javasrcipt 基础整理
- JavaSrcipt的Object.keys()
- 客户端javasrcipt操作Word
- JavaSrcipt获取HtmlStyle属性兼容方法
- JAVAsrcipt总结!
- javasrcipt的作用域和闭包(二)续篇之:函数内部提升机制与Variable Object
- javasrcipt系列---js闭包
- 关于JAVASRCIPT的方法的参数
- JavaSrcipt基础