第一题 function fun(obj){ let father='' function newArr(obj,arr=[],item=''){ father+=item?item+'.':'' for(let item in obj){ if(typeof obj[item]!='object'){ arr.push(father+obj[item]) }else{ newArr(obj[item],arr,item) } } return arr } return newArr(obj) } let res=fun(obj) console.log(res);