
[英]How to access specific values along with single key from Javascript associate array using for in loop
[英]Need to access every single values from inside of for loop in javascript
在这里,我在 for 循环之外创建了两个空数组,以便我从循环内部获得的值可以存储在这里。
注意 - 我也使用了 var 但它覆盖了最后一个值并且没有按预期工作。
const bottomTabNavigatorProducts = []
const categoryProductid = []
for (const key in UpdatedCategory) {
const actual = UpdatedCategory[key]
const categoryProducttitle = actual.title;
const categoryid = actual.id;
bottomTabNavigatorProducts.push(categoryProducttitle);
categoryProductid.push(categoryid);
}
const id = TotalProduct.filter(product => {
return product.title == (/* Need to compare above value here so that i can get list of matching array */)
});
我已经尝试了很多事情,但我又一次又一次地转来转去。 任何帮助将不胜感激,非常感谢。
我上次尝试结果的控制台。
我需要 end 我可以访问每个值,以便我可以使用 const id 过滤它以获得所需的数组和所需的 categoryProductid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.