方法1
function iterate(obj) { let arr=[] for(let key in obj){ if(obj.hasOwnProperty(key)){ arr.push(key.concat(': ',obj[key])) } }return arr }
方法2
function iterate(obj) { let arr=[] Object.keys(obj).forEach(key=>{ arr.push(key+': '+obj[key]) }) return arr }