我在JavaScript中具有以下Datastructur
data: {…}
0_0: {…}
file: “xy.jpg”
height: 256
width: 256
<prototype>: Object { … }
0_256: {…}
file: "xx.jpg"
height: 256
width: 256
<prototype>: Object { … }
如何从“ 0_256”获取数据?
答案 0 :(得分:2)
您需要使用data['0_256']
:
var data = {
'0_0': {
file: "xy.jpg",
height: 256,
width: 256
},
'0_256': {
file: "xx.jpg",
height: 256,
width: 256
}
};
console.log(data['0_256']);
答案 1 :(得分:1)
您可以尝试“ data ['0_256']”
`console.log(data['0_256'])`
var data = {
"0_0" :{
file: "xy.jpg",
height: 256,
width: 256
},
"0_256":{
file: "xx.jpg",
height: 256,
width: 256
}
}
console.log(data['0_256']);