1.遍历对象,在第一个键值对的地方跳出来
var form
={user
:'zhangsan',type
:'vip'}
var val
=null;
for(var key
in form
)
{
val
=form
[key
];
break;
}
2.把对象转化为数组,然后用数组的下标取值
Object
.keys(form
)
console
.log(Object
.keys(form
))
console
.log(Object
.keys(form
)[0])
console
.log(form
[Object
.keys(form
)[0]])
转载请注明原文地址:https://blackberry.8miu.com/read-35669.html