0

假设我有一个这样的 JavaScript 对象:

const some_shop = {
  toy: {
    cost: 2000
  },
  mobile: {
    cost: 1000
  },
  pc: {
    cost: 3000
  }
};

现在,每次购买其中一个物品时,我都会将我的数据推送到数据库中,其中一个物品是这样使用的quick.db

const x = pc // for example
const item = some_shop[x];
 let Structure = {
    name: item.toLowerCase(),
    prize: item.cost
  };
db.push(`items_${message.author.id}`, Structure);

现在我想显示项目值存储在数据库中的次数,假设我已经推送pc了两次,mobile一次我将如何返回它们已被找到一次/两次

4

0 回答 0