要求
获取当前页面已 Fork 的成员列表,存储在数组。代码短,耗时少者更佳。返回数组长度应该是 1000。
地址
https://github.com/facebook/react/network/members
示例代码
// 时间和函数长度统计
function timeAndLengthCount(callback){
const timeStart = new Date().getTime()
callback()
const timeEnd = new Date().getTime()
console.log('Time: ' + (timeEnd-timeStart) + 'ms')
console.log('Len: '+ callback.toString().length)
}
// 执行输出 Fork 成员列表的函数
// Time: 7ms
// Len: 223
timeAndLengthCount(()=>{
const forkedMenber = document.querySelectorAll('.repo > a:nth-child(odd)');
const forkedMenberList = [];
[].forEach.call(forkedMenber, z => forkedMenberList.push(z.innerHTML));
console.log(forkedMenberList);
})
接下来就是开始你的表演了
