摘要: 1、写法 function * smile() {} function* smile() {} function *smile() {} 星放哪里都可以,不过推荐第二个 function * smile() { const x = 1; yield x+ 1 // yield后面的表达是惰性计算的, 阅读全文
posted @ 2020-09-13 16:12 无用之美 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1、解析 class student extends person { construct(x,y) { super() this.x = x super.x = 3 // 这个最终是变成 this.x = 3 conslog.log(super.x) // 如果夫类中x可以打印出来的(person 阅读全文
posted @ 2020-09-13 14:00 无用之美 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 1、写法 如果constructor不写默认是会添加的 class 中的方法在原型上,而且用object.key(point) 返回是空数组 是遍历的跟对象上是不一样的,对象上是可以的遍历出来的 calss 是需要用new来创建实例的,如果不用new 回报错,但是构造函数可以不用new constr 阅读全文
posted @ 2020-09-13 13:36 无用之美 阅读(900) 评论(0) 推荐(0) 编辑
摘要: 1、export写法 a、写法一 export var name= 'smile'; export var sex = 'female'; b、写法二 var name = 'smile'; var sex = 'female' export {name,sex} 或命名 export {name 阅读全文
posted @ 2020-09-13 12:49 无用之美 阅读(206) 评论(0) 推荐(0) 编辑