B站 前端 一面凉经
1、自我介绍
2、项目相关
3、编程题
var person = {
first_name:"Mather",
last_name:"Gates",
_age:62,
eye_color:"blue",
children: [
{
first_name:"XUPENGFEI",
last_name:"feifei",
_age:25,
children: [
{
first_name:"XIAOFEIFEI",
last_name:"xiaofeifei",
_age:2,
}
]
}
]
};
function toCamel(str) {
return str.replace(/\_(\w)/g, function (all, letter) {
return letter.toUpperCase();
})
}
function copy(obj) {
if (typeof obj !== 'object') return 0;
let newObj = {};
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
newObj[toCamel(key)] = typeof obj[key] === 'object' ? copy(obj[key]) : obj[key];
}
}
return newObj;
}
console.log(copy(person));
first_name:"Mather",
last_name:"Gates",
_age:62,
eye_color:"blue",
children: [
{
first_name:"XUPENGFEI",
last_name:"feifei",
_age:25,
children: [
{
first_name:"XIAOFEIFEI",
last_name:"xiaofeifei",
_age:2,
}
]
}
]
};
function toCamel(str) {
return str.replace(/\_(\w)/g, function (all, letter) {
return letter.toUpperCase();
})
}
function copy(obj) {
if (typeof obj !== 'object') return 0;
let newObj = {};
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
newObj[toCamel(key)] = typeof obj[key] === 'object' ? copy(obj[key]) : obj[key];
}
}
return newObj;
}
console.log(copy(person));
将对象中的所有属性名改为驼峰式
4、Vue生命周期
#B站面经##春招##面经#