var obj = { name: ‘大白’;age:‘2’ }數組
1 var arr = [] 2 for (let i in obj) { 3 arr.push(obj[i]) 4 } 5 console.log(arr) // arr = ['大白', '2']
1 var arr = [] 2 for (let i in obj) { 3 var k = {} 4 k[i] = obj[i] 5 arr.push(k) 6 } 7 console.log(arr) // arr = [{'name': '大白'}, {'age': '2'}]