1.算法题:
写一个函数format,传入一个javascript object,输出格式化后的string,为了简化,我们规定object里只有number、array、object三种类型。比如
输入 const object = {
a:1,
b:2,
c: { d: 3 },
e: [4, 5, { g: 6 }]
}
输出 参考 JSON.stringify(object, null, ' ')
"{
"a": 1,
"b": 2,
"c": {
"d": 3
},
"e": [
4,
5,
{
"g": 6
}
]
}"console.log(stringifymore(object)); function stringify(value) { var type = typeof value; if (type === "number") { return `${value}` } if (type === "object") { if (value instanceof Array) { return "[" + value.map(stringify) + "]"; } else{ let temp = Object.keys(value).map( key => { let result = stringify(value[key]) return '"' + key + '"' + ":" + result } ).filter(item => item !== undefined) return"{" + temp+ "}" } } } function stringifymore (value){ let result = stringify(object); console.log(result); for(let i=0;i<result.length;i++){ if(....) } } const object1 = { a:1, b:2, c: { d: 3 }, e: [4, 5, { g: 6 }] } const object2 = [1,2,3,4] const object3 = 1 console.log(stringify(object1))
2.git flow规范?
3.git merge 和 git rebase的区别
4.css有几种盒子模型?怎么改变模型?
5.了解babel?
6.webpack了解吗?
7.了解事件循环吗?