节跳动全能内推码:HUMNANY,HC满满!!社招+实习+校招!!
校招投递链接: https://jobs.toutiao.com/s/Rn4aJX3
社招投递链接: https://job.toutiao.com/s/Rn4X7Q2
日常实习投递链接:https://job.toutiao.com/s/Rn4X5A7
校招投递链接: https://jobs.toutiao.com/s/Rn4aJX3
社招投递链接: https://job.toutiao.com/s/Rn4X7Q2
日常实习投递链接:https://job.toutiao.com/s/Rn4X5A7
全部评论
相关推荐
点赞 评论 收藏
分享
球球与墩墩:这不是前端常考的对象扁平化吗,面试官像是前端出来的
const flattern = (obj) => {
const res = {};
const dfs = (curr, path) => {
if(typeof curr === 'object' && curr !== null) {
const isArray = Array.isArray(curr);
for(let key in curr) {
const newPath = path ? isArray ? `${path}[${key}]` : `${path}.${key}` : key;
dfs(curr[key], newPath);
}
} else {
res[path] = curr
}
}
dfs(obj);
return res;
}
查看3道真题和解析 点赞 评论 收藏
分享
