时长:90min
面试官问得很灵活,是根据学了什么来问的,收获很大。
interface Task {
id: string;
deps: string[];
runTask: Function;
}
const input = [
{
id: "task1",
deps: [],
runTask: () => 3,
},
{
id: "task2",
deps: ["task1", "task3"],
runTask: (res1, res3) => 1 + res1 + res3,
},
{
id: "task3",
deps: ["task1"],
runTask: (res1) => 5 + res1,
},
{
id: "task4",
deps: ["task1", "task2"],
runTask: (res1, res2) => 3 + res1 + res2,
},
];
function runAllTask(list: Task[],cb:any) {
// ...
}
runAllTask(input, (err, res) => {
console.log(res);
/**
res应该为:
{ task1: 3, task2: 12, task3: 8, task4: 18 }
*/
});
倒了,无二面,但是收获很多,后面会去重新巩固基础。
#蓝湖##前端面经##面经##前端##面试复盘#