2020年1月21日

摘要: //generator是可以用来控制迭代器的函数,可以暂停,也可以任何时候恢复function * loop () { for(let i = 0; i < 5; i++) { yield console.log(i) } } const l = loop() l.next() l.next() f 阅读全文
posted @ 2020-01-21 22:26 bobo2404 阅读(156) 评论(0) 推荐(0) 编辑
 
摘要: //场景一:可以修改对象的值let o = { name: 'xiaoming', price: 190 } let d = new Proxy(o,{ get (target,key){ if(key 'price'){ return target[key] + 20 }else{ return 阅读全文
posted @ 2020-01-21 16:36 bobo2404 阅读(468) 评论(0) 推荐(0) 编辑