var a = {
b:3,
c:4,
d:5,
作业事件:3123123
}
var arr = []
for(var i in a ){
arr.push(i)
}
var str = arr[arr.length-1]
arr. splice(arr.length-1,1)
arr.unshift(str)
var newdata= {}
for (var n in arr){
console.log(n,arr,arr[n])
var itme =arr[n]
newdata[itme]=a[itme]
}
console.log(newdata)
//改变对象属性的顺序
var arr=Object.keys(a)
var str = arr[arr.length-1]
arr. splice(arr.length-1,1)
arr.unshift(str)
var newData={}
arr.map(key => {
newData[key]=a[key]
})
console.log(newData)
Object.keys(a) 对象转成数组