有赞前端一面凉经
1. 返回按层序遍历得到的节点值(即逐层地,从左到右访问所有节点)
function levelOrder(root) { // 参考答案 let res = []; const demo = (arr, depth) => { res[depth] = res[depth] || []; for (let item of arr) { res[depth].push(item['data']); if (item['children']) { demo(item['children'], depth + 1); } } } demo([root], 0) return res; } const root = { data: 1, children: [ { data: 2 }, { data: 3 }, { data: 4, children: [{ data: 5 }, { data: 6 }, { data: 7 }] } ] } console.log(levelOrder(root)); /** * [ * [1], * [2,3,4], * [5,6,7] * ] */
2. 对象的键从蛇形命名改为驼峰命名
function mapKeyToCamelCase(data) { // 参考答案 const rename = (name) => { return name.split('_').reduce((pre, current) => { return pre + current[0].toUpperCase() + current.substring(1) }); } let res = Array.isArray(data) ? [] : {}; for (let i in data) { if (typeof data[i] === 'object' && data[i] !== null) { res[rename(i)] = mapKeyToCamelCase(data[i]) } else { res[rename(i)] = data[i]; } } return res; } const testData = { a_bbb: 123, a_g: [1, 2, 3, 4], a_d: { s: 2, s_d: 3, }, a_f: [ 1, 2, 3, { a_g: 5 } ], a_d_s: 1 } console.log(mapKeyToCamelCase(testData))
3.
如何遍历对象的值
for of 能遍历对象吗
for in 和 for of 的区别
for in 的缺点
4. 自我介绍
前端接触了多久
怎么接触的前端
学习前端的方法(什么论坛、什么博客)
碰到问题怎么解决(谷歌搜索、百度搜索)
⚠️⚠️⚠️前方高能⚠️⚠️⚠️
⚠️⚠️⚠️前方高能⚠️⚠️⚠️
⚠️⚠️⚠️前方高能⚠️⚠️⚠️
谷歌是被墙掉的,你是怎么用谷歌的
怎么翻q的
这个翻q服务器是服务商提供的还是自己搭建的
有用自己的服务器搭建翻q吗
怎么搭的
5.介绍linux权限位
权限744是什么意思
https://blog.csdn.net/u013197629/article/details/73608613
6.讲项目,你在项目里做的什么工作(功能是怎么实现的)
7.接触过react吗,vue用的什么版本,vue3.0有去了解吗
proxy的缺点优点
vue2中如何复用代码
vue3 的composition api推出的目的是什么(有什么好处)
ref 和 reactive
https://zhuanlan.zhihu.com/p/267967246
vue 编译过程
https://segmentfault.com/a/1190000020013226
虚拟DOM和真实DOM比较
还有什么方法可以获取对象的key
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
for in 和 Object.keys()的区别
太菜了没有反问环节
#秋招##前端工程师##面经##前端##校招#