Skip to content

Commit

Permalink
day127 add
Browse files Browse the repository at this point in the history
  • Loading branch information
wanggenzhen authored and wanggenzhen committed Aug 27, 2020
1 parent 3e5e96b commit 67dce85
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 4 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,41 @@

> 每天get一个知识点

### Day126:请描述 CSRF、XSS 的基本概念、攻击原理和防御措施?

**[答案&解析](https://github.com/lgwebdream/FE-Interview-Planet/issues/939)**
### Day127:按要求完成 mergePromise 代码

```js
const timeout = (ms) =>
new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms);
});
const ajax1 = () =>
timeout(2000).then(() => {
console.log("1");
return 1;
});
const ajax2 = () =>
timeout(1000).then(() => {
console.log("2");
return 2;
});
const ajax3 = () =>
timeout(2000).then(() => {
console.log("3");
return 3;
});
const mergePromise = (ajaxArray) => {
// 1,2,3 done [1,2,3] 此处写代码 请写出ES6、ES3 2中解法
};
mergePromise([ajax1, ajax2, ajax3]).then((data) => {
console.log("done");
console.log(data); // data 为[1,2,3]
});
// 执行结果为:1 2 3 done [1,2,3]
```

**[答案&解析](https://github.com/lgwebdream/FE-Interview-Planet/issues/940)**

<br />

Expand Down
2 changes: 1 addition & 1 deletion summarry/all.md
Original file line number Diff line number Diff line change
Expand Up @@ -8916,7 +8916,7 @@ person.method(fn, 1);

### React SSR实现过程?原理是什么?有什么注意事项?

分类:Node
分类:React

[答案&解析](https://github.com/lgwebdream/FE-Interview/issues/869)

Expand Down
42 changes: 42 additions & 0 deletions summarry/daily.md
Original file line number Diff line number Diff line change
Expand Up @@ -1910,3 +1910,45 @@ console.log(a.b)
[答案&解析](https://github.com/lgwebdream/FE-Interview-Planet/issues/939)

<br />

### Day127:按要求完成 mergePromise 代码

```js
const timeout = (ms) =>
new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms);
});
const ajax1 = () =>
timeout(2000).then(() => {
console.log("1");
return 1;
});
const ajax2 = () =>
timeout(1000).then(() => {
console.log("2");
return 2;
});
const ajax3 = () =>
timeout(2000).then(() => {
console.log("3");
return 3;
});
const mergePromise = (ajaxArray) => {
// 1,2,3 done [1,2,3] 此处写代码 请写出ES6、ES3 2中解法
};
mergePromise([ajax1, ajax2, ajax3]).then((data) => {
console.log("done");
console.log(data); // data 为[1,2,3]
});
// 执行结果为:1 2 3 done [1,2,3]
```

公司:阿里

分类:JavaScript、编程题

[答案&解析](https://github.com/lgwebdream/FE-Interview-Planet/issues/940)

<br />

0 comments on commit 67dce85

Please sign in to comment.