返回博主主页
摘要: 1. result.value.then function* gen(){ // var url = 'https://api.github.com/users/github'; var url = 'https//:www.baidu.com'; var result = yield fetch( 阅读全文
posted @ 2021-10-28 21:34 懒惰的星期六 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 1.带参数(10),需使用return。并且下一次调用next没有用了。 function* gen(x) { for (var x of [1,2,3,4,5]){ var y = yield (x + 2); return y+10; } } var g = gen(1); console.lo 阅读全文
posted @ 2021-10-28 21:06 懒惰的星期六 阅读(252) 评论(0) 推荐(0) 编辑
摘要: function* gen(x){ try { var y = yield x + 2; } catch (e){ console.log(e); console.log("进入异常catch输出"); } return y; } var g = gen(1); console.log(g.next 阅读全文
posted @ 2021-10-28 19:48 懒惰的星期六 阅读(101) 评论(0) 推荐(0) 编辑
摘要: function dad(){ this.name = "123" this.age = 33 } var dad1 = new dad() var dad2 = new dad() dad.prototype.funcd= ()=>{ console.log("funcdddddd") } //通 阅读全文
posted @ 2021-10-28 16:04 懒惰的星期六 阅读(513) 评论(0) 推荐(0) 编辑
摘要: new 和不 new的区别: 如果 new 了函数内的 this 会指向当前这个 person 并且就算函数内部不 return 也会返回一个对象。 如果不 new 的话函数内的 this 指向的是 window。 function person(firstname,lastname,age,eye 阅读全文
posted @ 2021-10-28 15:38 懒惰的星期六 阅读(564) 评论(0) 推荐(0) 编辑
摘要: 数组作为函数的返回值进行结构的时候,一些问题。 "use strict" function returnArray() { var [left, right, top, bottom] = [1, 2 ,3 ,4] console.log(left, right, top, bottom) retu 阅读全文
posted @ 2021-10-28 11:24 懒惰的星期六 阅读(26) 评论(0) 推荐(0) 编辑

Welcome to here

主页