摘要:
1. result.value.then function* gen(){ // var url = 'https://api.github.com/users/github'; var url = 'https//:www.baidu.com'; var result = yield fetch( 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
function dad(){ this.name = "123" this.age = 33 } var dad1 = new dad() var dad2 = new dad() dad.prototype.funcd= ()=>{ console.log("funcdddddd") } //通 阅读全文
摘要:
new 和不 new的区别: 如果 new 了函数内的 this 会指向当前这个 person 并且就算函数内部不 return 也会返回一个对象。 如果不 new 的话函数内的 this 指向的是 window。 function person(firstname,lastname,age,eye 阅读全文
摘要:
数组作为函数的返回值进行结构的时候,一些问题。 "use strict" function returnArray() { var [left, right, top, bottom] = [1, 2 ,3 ,4] console.log(left, right, top, bottom) retu 阅读全文