猿问

在javascript中循环对象

我知道这是我应该知道的事情,但我无法弄清楚。


const food = {

  "design": [

    {

      "forTemperature": {

        "high": "100",

        "low": "70"

      },

      "productURL": "",

      "imageURL": ""

    },

    {

      "forTemperature": {

        "high": "80",

        "low": "65"

      },

      "productURL": "",

      "imageURL": ""

    },

    {

      "forTemperature": {

        "high": "75",

        "low": "65"

      },

      "productURL": "",

      "imageURL": ""

    },

    {

      "forTemperature": {

        "high": "67",

        "low": "60"

      },

      "productURL": "",

      "imageURL": ""

    }

  ]

}

我拥有的基本 json 文件,数组中的对象,但执行以下操作:


food.design.map((item, i) => i

对我不起作用。


我需要采取什么方法?


梦里花落0921
浏览 164回答 3
3回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答