gpt4 book ai didi

javascript - 从javascript中括号之间的多个数组循环

转载 作者:行者123 更新时间:2023-11-30 10:12:27 25 4
gpt4 key购买 nike

<分区>

您好,我无法从这个数组中获取数据。

 var myvar = {
"403": {
"3": {
"name": "girl",
"types": {
"1": {
"name": "pants",
"sizes": [{
"230": "50/56 (0-2 mon)"
}, {
"231": "62/68 (2-6 mon)"
}, {
"232": "74/80 (6-12 mon)"
}]
},
"4": {
"name": "tshirt",
"sizes": [{
"230": "50/56 (0-2 mon)"
}, {
"231": "62/68 (2-6 mon)"
}, {
"232": "74/80 (6-12 mon)"
}]
}
}
},
"4": {
"name": "boy",
"types": {
"1": {
"name": "Byxor",
"sizes": [{
"230": "50/56 (0-2 mon)"
}, {
"231": "62/68 (2-6 mon)"
}]
}
}
}
},
"401": {
"1": {
"name": "woman",
"types": {
"2": {
"name": "Jeans",
"sizes": [{
"40": "25 inch"
}, {
"41": "26 inch"
}]
},
"1": {
"name": "Tshirt",
"sizes": [{
"60": "32 (XS)"
}, {
"61": "34 (XS)"
}, {
"62": "36 (S)"
}]
}
}
},
"2": {
"name": "Mr",
"types": {
"2": {
"name": "Jeans",
"sizes": [{
"43": "28 inch"
}, {
"44": "29 inch"
}]
},
"1": {
"name": "Tshirt",
"sizes": [{
"90": "44 (S)"
}, {
"91": "46 (S)"
}]
}
}
}
}
};

我还有其他变量 secondvar 可以是 403 或 401 然后检索该数字的值。

这可能吗?然后用同样的方法获取最后一个数据的内部数据 假设 thirdvariable 的值为 3 和 4

如上例所示。对于“forthvariable”也是如此,它可以在变量“thirdvariable”的数字 3 下取 1 和 4,并获取其数据 namesizes

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com